Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e58a92b7 authored by Patrick Williams's avatar Patrick Williams
Browse files

Allow root to create secure virtual displays.

Bug: 324890339
Test: SurfaceFlinger_test
Change-Id: I6b49f3dfc3d66dd7d5e66f99b9947245fc708bc0
parent 8127c23d
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -578,11 +578,11 @@ void SurfaceFlinger::run() {

sp<IBinder> SurfaceFlinger::createDisplay(const String8& displayName, bool secure,
                                          float requestedRefreshRate) {
    // onTransact already checks for some permissions, but adding an additional check here.
    // This is to ensure that only system and graphics can request to create a secure
    // SurfaceComposerAIDL checks for some permissions, but adding an additional check here.
    // This is to ensure that only root, system, and graphics can request to create a secure
    // display. Secure displays can show secure content so we add an additional restriction on it.
    const int uid = IPCThreadState::self()->getCallingUid();
    if (secure && uid != AID_GRAPHICS && uid != AID_SYSTEM) {
    if (secure && uid != AID_ROOT && uid != AID_GRAPHICS && uid != AID_SYSTEM) {
        ALOGE("Only privileged processes can create a secure display");
        return nullptr;
    }
+1 −1
Original line number Diff line number Diff line
@@ -241,7 +241,7 @@ TEST_F(CredentialsTest, CreateDisplayTest) {
    // Check with root.
    {
        UIDFaker f(AID_ROOT);
        ASSERT_FALSE(condition());
        ASSERT_TRUE(condition());
    }

    // Check as a Graphics user.