mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-05 19:31:57 -04:00
UPSTREAM: seccomp: kill process instead of thread for unknown actions
Asynchronous termination of a thread outside of the userspace thread library's knowledge is an unsafe operation that leaves the process in an inconsistent, corrupt, and possibly unrecoverable state. In order to make new actions that may be added in the future safe on kernels not aware of them, change the default action from SECCOMP_RET_KILL_THREAD to SECCOMP_RET_KILL_PROCESS. Signed-off-by: Rich Felker <dalias@libc.org> Link: https://lore.kernel.org/r/20200829015609.GA32566@brightrain.aerifal.cx [kees: Fixed up coredump selection logic to match] Signed-off-by: Kees Cook <keescook@chromium.org> (cherry picked from commit 4d671d922d51907bc41f1f7f2dc737c928ae78fd) Signed-off-by: Jeff Vander Stoep <jeffv@google.com> Bug: 176068146 Change-Id: I23140e1efbb4346de8566421c35d2810de26b209
This commit is contained in:
parent
43c11dbfa8
commit
c6279c1cb7
1 changed files with 4 additions and 4 deletions
|
|
@ -960,7 +960,7 @@ static int __seccomp_filter(int this_syscall, const struct seccomp_data *sd,
|
|||
current->seccomp.mode = SECCOMP_MODE_DEAD;
|
||||
seccomp_log(this_syscall, SIGSYS, action, true);
|
||||
/* Dump core only if this is the last remaining thread. */
|
||||
if (action == SECCOMP_RET_KILL_PROCESS ||
|
||||
if (action != SECCOMP_RET_KILL_THREAD ||
|
||||
get_nr_threads(current) == 1) {
|
||||
kernel_siginfo_t info;
|
||||
|
||||
|
|
@ -970,10 +970,10 @@ static int __seccomp_filter(int this_syscall, const struct seccomp_data *sd,
|
|||
seccomp_init_siginfo(&info, this_syscall, data);
|
||||
do_coredump(&info);
|
||||
}
|
||||
if (action == SECCOMP_RET_KILL_PROCESS)
|
||||
do_group_exit(SIGSYS);
|
||||
else
|
||||
if (action == SECCOMP_RET_KILL_THREAD)
|
||||
do_exit(SIGSYS);
|
||||
else
|
||||
do_group_exit(SIGSYS);
|
||||
}
|
||||
|
||||
unreachable();
|
||||
|
|
|
|||
Loading…
Reference in a new issue