diff options
author | James Morris <james.l.morris@oracle.com> | 2016-01-28 10:53:54 +1100 |
---|---|---|
committer | James Morris <james.l.morris@oracle.com> | 2016-01-28 10:53:54 +1100 |
commit | 1c1ecf172a4616cd8567182b99efa7a5df77f5d2 (patch) | |
tree | 21d99ac3a8314fc513b6e58831d6e169d337e17d /kernel | |
parent | eee045021fb22aeac7f5d6f2092430b530c880ee (diff) | |
parent | 103502a35cfce0710909da874f092cb44823ca03 (diff) | |
download | linux-1c1ecf172a4616cd8567182b99efa7a5df77f5d2.tar.bz2 |
Merge tag 'seccomp-4.5-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux into for-linus
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/seccomp.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/kernel/seccomp.c b/kernel/seccomp.c index 580ac2d4024f..15a1795bbba1 100644 --- a/kernel/seccomp.c +++ b/kernel/seccomp.c @@ -316,24 +316,24 @@ static inline void seccomp_sync_threads(void) put_seccomp_filter(thread); smp_store_release(&thread->seccomp.filter, caller->seccomp.filter); + + /* + * Don't let an unprivileged task work around + * the no_new_privs restriction by creating + * a thread that sets it up, enters seccomp, + * then dies. + */ + if (task_no_new_privs(caller)) + task_set_no_new_privs(thread); + /* * Opt the other thread into seccomp if needed. * As threads are considered to be trust-realm * equivalent (see ptrace_may_access), it is safe to * allow one thread to transition the other. */ - if (thread->seccomp.mode == SECCOMP_MODE_DISABLED) { - /* - * Don't let an unprivileged task work around - * the no_new_privs restriction by creating - * a thread that sets it up, enters seccomp, - * then dies. - */ - if (task_no_new_privs(caller)) - task_set_no_new_privs(thread); - + if (thread->seccomp.mode == SECCOMP_MODE_DISABLED) seccomp_assign_mode(thread, SECCOMP_MODE_FILTER); - } } } |