diff options
author | Joel Stanley <joel@jms.id.au> | 2019-05-08 16:48:45 +0300 |
---|---|---|
committer | Joel Stanley <joel@jms.id.au> | 2019-05-08 16:48:48 +0300 |
commit | d09fc0c4bdfbcbe251df247b5a94e2a07dec9c2f (patch) | |
tree | 893d98100d3ede2ff76905a67e1b9798c8c88868 /kernel/seccomp.c | |
parent | 76cc3bd0c342199b0bc0fd6afc7035274bf7a718 (diff) | |
parent | 274ede3e1a5fb3d0fd33acafb08993e95972c51f (diff) | |
download | linux-dev-5.0.tar.xz |
Merge tag 'v5.0.14' into dev-5.0dev-5.0
This is the 5.0.14 stable release
Signed-off-by: Joel Stanley <joel@jms.id.au>
Diffstat (limited to 'kernel/seccomp.c')
-rw-r--r-- | kernel/seccomp.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/kernel/seccomp.c b/kernel/seccomp.c index e815781ed751..181e72718434 100644 --- a/kernel/seccomp.c +++ b/kernel/seccomp.c @@ -500,7 +500,10 @@ out: * * Caller must be holding current->sighand->siglock lock. * - * Returns 0 on success, -ve on error. + * Returns 0 on success, -ve on error, or + * - in TSYNC mode: the pid of a thread which was either not in the correct + * seccomp mode or did not have an ancestral seccomp filter + * - in NEW_LISTENER mode: the fd of the new listener */ static long seccomp_attach_filter(unsigned int flags, struct seccomp_filter *filter) @@ -1256,6 +1259,16 @@ static long seccomp_set_mode_filter(unsigned int flags, if (flags & ~SECCOMP_FILTER_FLAG_MASK) return -EINVAL; + /* + * In the successful case, NEW_LISTENER returns the new listener fd. + * But in the failure case, TSYNC returns the thread that died. If you + * combine these two flags, there's no way to tell whether something + * succeeded or failed. So, let's disallow this combination. + */ + if ((flags & SECCOMP_FILTER_FLAG_TSYNC) && + (flags & SECCOMP_FILTER_FLAG_NEW_LISTENER)) + return -EINVAL; + /* Prepare the new filter before holding any locks. */ prepared = seccomp_prepare_user_filter(filter); if (IS_ERR(prepared)) @@ -1302,7 +1315,7 @@ out: mutex_unlock(¤t->signal->cred_guard_mutex); out_put_fd: if (flags & SECCOMP_FILTER_FLAG_NEW_LISTENER) { - if (ret < 0) { + if (ret) { listener_f->private_data = NULL; fput(listener_f); put_unused_fd(listener); |