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

Commit dd673a63 authored by Wale Ogunwale's avatar Wale Ogunwale
Browse files

Prevent system uid component from running in an app process

Bug: 21669445
Change-Id: I11d0bc5301d7e2a64972221f54f3cbd611f8e404
(cherry picked from commit 44368567)
parent 5e50e00c
Loading
Loading
Loading
Loading
+8 −3
Original line number Original line Diff line number Diff line
@@ -2695,9 +2695,14 @@ public final class ActivityManagerService extends ActivityManagerNative
            // should never happen).
            // should never happen).
            SparseArray<ProcessRecord> procs = mProcessNames.getMap().get(processName);
            SparseArray<ProcessRecord> procs = mProcessNames.getMap().get(processName);
            if (procs == null) return null;
            if (procs == null) return null;
            final int N = procs.size();
            final int procCount = procs.size();
            for (int i = 0; i < N; i++) {
            for (int i = 0; i < procCount; i++) {
                if (UserHandle.isSameUser(procs.keyAt(i), uid)) return procs.valueAt(i);
                final int procUid = procs.keyAt(i);
                if (UserHandle.isApp(procUid) || !UserHandle.isSameUser(procUid, uid)) {
                    // Don't use an app process or different user process for system component.
                    continue;
                }
                return procs.valueAt(i);
            }
            }
        }
        }
        ProcessRecord proc = mProcessNames.get(processName, uid);
        ProcessRecord proc = mProcessNames.get(processName, uid);