Skip to content

Commit c10a477

Browse files
committed
Set capabilities sooner.
(cherry-pick from gingerbread I4e34b60c0a01b85ce0d80eb96ff3510604a68c71) Bug 3176774 Change-Id: I34d36b5b215ff0465f4f2f148c675f37ceba1a78
1 parent 05cc2d6 commit c10a477

File tree

2 files changed

+3
-26
lines changed

2 files changed

+3
-26
lines changed

core/java/com/android/internal/os/ZygoteConnection.java

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -680,19 +680,6 @@ private void handleChildProc(Arguments parsedArgs,
680680
FileDescriptor[] descriptors, PrintStream newStderr)
681681
throws ZygoteInit.MethodAndArgsCaller {
682682

683-
/*
684-
* First, set the capabilities if necessary
685-
*/
686-
687-
if (parsedArgs.uid != 0) {
688-
try {
689-
ZygoteInit.setCapabilities(parsedArgs.permittedCapabilities,
690-
parsedArgs.effectiveCapabilities);
691-
} catch (IOException ex) {
692-
Log.e(TAG, "Error setting capabilities", ex);
693-
}
694-
}
695-
696683
/*
697684
* Close the socket, unless we're in "peer wait" mode, in which
698685
* case it's used to track the liveness of this process.

core/java/com/android/internal/os/ZygoteInit.java

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -508,18 +508,6 @@ private static int preloadDrawables(VMRuntime runtime, TypedArray ar) {
508508
private static void handleSystemServerProcess(
509509
ZygoteConnection.Arguments parsedArgs)
510510
throws ZygoteInit.MethodAndArgsCaller {
511-
/*
512-
* First, set the capabilities if necessary
513-
*/
514-
515-
if (parsedArgs.uid != 0) {
516-
try {
517-
setCapabilities(parsedArgs.permittedCapabilities,
518-
parsedArgs.effectiveCapabilities);
519-
} catch (IOException ex) {
520-
Log.e(TAG, "Error setting capabilities", ex);
521-
}
522-
}
523511

524512
closeServerSocket();
525513

@@ -565,7 +553,9 @@ private static boolean startSystemServer()
565553
/* Request to fork the system server process */
566554
pid = Zygote.forkSystemServer(
567555
parsedArgs.uid, parsedArgs.gid,
568-
parsedArgs.gids, debugFlags, null);
556+
parsedArgs.gids, debugFlags, null,
557+
parsedArgs.permittedCapabilities,
558+
parsedArgs.effectiveCapabilities);
569559
} catch (IllegalArgumentException ex) {
570560
throw new RuntimeException(ex);
571561
}

0 commit comments

Comments
 (0)