diff options
| author | Andrei Vagin <avagin@google.com> | 2020-10-09 10:44:28 -0700 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2020-10-09 21:48:35 +0200 |
| commit | 93817d892548db363431ebb7f31518df0d8582ec (patch) | |
| tree | c94b9dd892cea496c4e3d00105f96c7e614c6f7a /executor | |
| parent | dcf117a24d23d280b2e9128caac89cea86de617a (diff) | |
executor: set parent-death signal after changing user or group ID-s
The parent-death signal is set in sandbox_common, but then setresuid and
setresgid clear it and we need to set it again.
Signed-off-by: Andrei Vagin <avagin@google.com>
Diffstat (limited to 'executor')
| -rw-r--r-- | executor/common_linux.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/executor/common_linux.h b/executor/common_linux.h index 402892dac..146984b3b 100644 --- a/executor/common_linux.h +++ b/executor/common_linux.h @@ -3772,6 +3772,8 @@ static int do_sandbox_setuid(void) if (syscall(SYS_setresuid, nobody, nobody, nobody)) fail("failed to setresuid"); + // setresuid and setresgid clear the parent-death signal. + prctl(PR_SET_PDEATHSIG, SIGKILL, 0, 0, 0); // This is required to open /proc/self/ files. // Otherwise they are owned by root and we can't open them after setuid. // See task_dump_owner function in kernel. @@ -4067,6 +4069,9 @@ static int do_sandbox_android(void) if (setresuid(UNTRUSTED_APP_UID, UNTRUSTED_APP_UID, UNTRUSTED_APP_UID) != 0) fail("setresuid failed"); + // setresuid and setresgid clear the parent-death signal. + prctl(PR_SET_PDEATHSIG, SIGKILL, 0, 0, 0); + syz_setfilecon(".", SELINUX_LABEL_APP_DATA_FILE); syz_setcon(SELINUX_CONTEXT_UNTRUSTED_APP); |
