From 93817d892548db363431ebb7f31518df0d8582ec Mon Sep 17 00:00:00 2001 From: Andrei Vagin Date: Fri, 9 Oct 2020 10:44:28 -0700 Subject: 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 --- executor/common_linux.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'executor/common_linux.h') 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); -- cgit mrf-deployment