Permalink
Browse files

Merge remote-tracking branch 'cern/multiuser-regression-v1' into cm-11.0

Conflicts:
	Superuser/jni/su/su.c

Change-Id: I2474f5048e590592e1baa7f4bb1caf76e1245b74
  • Loading branch information...
koush committed Nov 29, 2013
2 parents efc2142 + 699e4a9 commit a43f033dc9a1472821e57aab76b67b76263c99c4
Showing with 24 additions and 0 deletions.
  1. +24 −0 Superuser/jni/su/su.c
View
@@ -607,6 +607,28 @@ static int get_api_version() {
return ver;
}
static void fork_for_samsung(void)
{
// Samsung CONFIG_SEC_RESTRICT_SETUID wants the parent process to have
// EUID 0, or else our setresuid() calls will be denied. So make sure
// all such syscalls are executed by a child process.
int rv;
switch (fork()) {
case 0:
return;
case -1:
PLOGE("fork");
exit(1);
default:
if (wait(&rv) < 0) {
exit(1);
} else {
exit(WEXITSTATUS(rv));
}
}
}
int main(int argc, char *argv[]) {
return su_main(argc, argv, 1);
}
@@ -617,6 +639,8 @@ int su_main(int argc, char *argv[], int need_client) {
return run_daemon();
}
fork_for_samsung();
// Sanitize all secure environment variables (from linker_environ.c in AOSP linker).
/* The same list than GLibc at this point */
static const char* const unsec_vars[] = {

0 comments on commit a43f033

Please sign in to comment.