summaryrefslogtreecommitdiffstats
path: root/kernel/ptrace.c
diff options
context:
space:
mode:
authorJames Morris <james.l.morris@oracle.com>2015-07-20 17:19:19 +1000
committerJames Morris <james.l.morris@oracle.com>2015-07-20 17:19:19 +1000
commitfe6c59dc17908effd4e2caa666795b9ad984005b (patch)
tree9c3261a0eef864b7ec7fe52d93e1d1c5c165d901 /kernel/ptrace.c
parent52721d9d3334c1cb1f76219a161084094ec634dc (diff)
parent221272f97ca528048a577a3ff23d7774286ca5fd (diff)
downloadlinux-fe6c59dc17908effd4e2caa666795b9ad984005b.tar.bz2
Merge tag 'seccomp-next' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux into next
Diffstat (limited to 'kernel/ptrace.c')
-rw-r--r--kernel/ptrace.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/kernel/ptrace.c b/kernel/ptrace.c
index c8e0e050a36a..787320de68e0 100644
--- a/kernel/ptrace.c
+++ b/kernel/ptrace.c
@@ -556,6 +556,19 @@ static int ptrace_setoptions(struct task_struct *child, unsigned long data)
if (data & ~(unsigned long)PTRACE_O_MASK)
return -EINVAL;
+ if (unlikely(data & PTRACE_O_SUSPEND_SECCOMP)) {
+ if (!config_enabled(CONFIG_CHECKPOINT_RESTORE) ||
+ !config_enabled(CONFIG_SECCOMP))
+ return -EINVAL;
+
+ if (!capable(CAP_SYS_ADMIN))
+ return -EPERM;
+
+ if (seccomp_mode(&current->seccomp) != SECCOMP_MODE_DISABLED ||
+ current->ptrace & PT_SUSPEND_SECCOMP)
+ return -EPERM;
+ }
+
/* Avoid intermediate state when all opts are cleared */
flags = child->ptrace;
flags &= ~(PTRACE_O_MASK << PT_OPT_FLAG_SHIFT);