aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorKees Cook <keescook@chromium.org>2018-05-01 18:19:04 -0400
committerThomas Gleixner <tglx@linutronix.de>2018-05-03 07:55:51 -0400
commit7bbf1373e228840bb0295a2ca26d548ef37f448e (patch)
treeb03e2356ba64fa645695440d0519324c43f365aa /kernel
parenta73ec77ee17ec556fe7f165d00314cb7c047b1ac (diff)
nospec: Allow getting/setting on non-current task
Adjust arch_prctl_get/set_spec_ctrl() to operate on tasks other than current. This is needed both for /proc/$pid/status queries and for seccomp (since thread-syncing can trigger seccomp in non-current threads). Signed-off-by: Kees Cook <keescook@chromium.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/sys.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/kernel/sys.c b/kernel/sys.c
index b76dee23bdc9..b0eee418ee0d 100644
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -2244,12 +2244,13 @@ static int propagate_has_child_subreaper(struct task_struct *p, void *data)
2244 return 1; 2244 return 1;
2245} 2245}
2246 2246
2247int __weak arch_prctl_spec_ctrl_get(unsigned long which) 2247int __weak arch_prctl_spec_ctrl_get(struct task_struct *t, unsigned long which)
2248{ 2248{
2249 return -EINVAL; 2249 return -EINVAL;
2250} 2250}
2251 2251
2252int __weak arch_prctl_spec_ctrl_set(unsigned long which, unsigned long ctrl) 2252int __weak arch_prctl_spec_ctrl_set(struct task_struct *t, unsigned long which,
2253 unsigned long ctrl)
2253{ 2254{
2254 return -EINVAL; 2255 return -EINVAL;
2255} 2256}
@@ -2465,12 +2466,12 @@ SYSCALL_DEFINE5(prctl, int, option, unsigned long, arg2, unsigned long, arg3,
2465 case PR_GET_SPECULATION_CTRL: 2466 case PR_GET_SPECULATION_CTRL:
2466 if (arg3 || arg4 || arg5) 2467 if (arg3 || arg4 || arg5)
2467 return -EINVAL; 2468 return -EINVAL;
2468 error = arch_prctl_spec_ctrl_get(arg2); 2469 error = arch_prctl_spec_ctrl_get(me, arg2);
2469 break; 2470 break;
2470 case PR_SET_SPECULATION_CTRL: 2471 case PR_SET_SPECULATION_CTRL:
2471 if (arg4 || arg5) 2472 if (arg4 || arg5)
2472 return -EINVAL; 2473 return -EINVAL;
2473 error = arch_prctl_spec_ctrl_set(arg2, arg3); 2474 error = arch_prctl_spec_ctrl_set(me, arg2, arg3);
2474 break; 2475 break;
2475 default: 2476 default:
2476 error = -EINVAL; 2477 error = -EINVAL;