diff options
author | Al Viro <viro@ZenIV.linux.org.uk> | 2013-09-01 15:35:01 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-09-26 20:18:13 -0400 |
commit | a168ad2687045d24e98b2525d1ee678c4f2a9a96 (patch) | |
tree | c926544081dae0bae8e31240f745979bc0c702c1 /arch/x86/kernel/signal.c | |
parent | 1159cd1ded90b41db788f84bf94644a810dd322a (diff) |
Introduce [compat_]save_altstack_ex() to unbreak x86 SMAP
commit bd1c149aa9915b9abb6d83d0f01dfd2ace0680b5 upstream.
For performance reasons, when SMAP is in use, SMAP is left open for an
entire put_user_try { ... } put_user_catch(); block, however, calling
__put_user() in the middle of that block will close SMAP as the
STAC..CLAC constructs intentionally do not nest.
Furthermore, using __put_user() rather than put_user_ex() here is bad
for performance.
Thus, introduce new [compat_]save_altstack_ex() helpers that replace
__[compat_]save_altstack() for x86, being currently the only
architecture which supports put_user_try { ... } put_user_catch().
Reported-by: H. Peter Anvin <hpa@linux.intel.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Link: http://lkml.kernel.org/n/tip-es5p6y64if71k8p5u08agv9n@git.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'arch/x86/kernel/signal.c')
-rw-r--r-- | arch/x86/kernel/signal.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/arch/x86/kernel/signal.c b/arch/x86/kernel/signal.c index 69562992e457..087ab2af381a 100644 --- a/arch/x86/kernel/signal.c +++ b/arch/x86/kernel/signal.c | |||
@@ -364,7 +364,7 @@ static int __setup_rt_frame(int sig, struct ksignal *ksig, | |||
364 | else | 364 | else |
365 | put_user_ex(0, &frame->uc.uc_flags); | 365 | put_user_ex(0, &frame->uc.uc_flags); |
366 | put_user_ex(0, &frame->uc.uc_link); | 366 | put_user_ex(0, &frame->uc.uc_link); |
367 | err |= __save_altstack(&frame->uc.uc_stack, regs->sp); | 367 | save_altstack_ex(&frame->uc.uc_stack, regs->sp); |
368 | 368 | ||
369 | /* Set up to return from userspace. */ | 369 | /* Set up to return from userspace. */ |
370 | restorer = VDSO32_SYMBOL(current->mm->context.vdso, rt_sigreturn); | 370 | restorer = VDSO32_SYMBOL(current->mm->context.vdso, rt_sigreturn); |
@@ -429,7 +429,7 @@ static int __setup_rt_frame(int sig, struct ksignal *ksig, | |||
429 | else | 429 | else |
430 | put_user_ex(0, &frame->uc.uc_flags); | 430 | put_user_ex(0, &frame->uc.uc_flags); |
431 | put_user_ex(0, &frame->uc.uc_link); | 431 | put_user_ex(0, &frame->uc.uc_link); |
432 | err |= __save_altstack(&frame->uc.uc_stack, regs->sp); | 432 | save_altstack_ex(&frame->uc.uc_stack, regs->sp); |
433 | 433 | ||
434 | /* Set up to return from userspace. If provided, use a stub | 434 | /* Set up to return from userspace. If provided, use a stub |
435 | already in userspace. */ | 435 | already in userspace. */ |
@@ -496,7 +496,7 @@ static int x32_setup_rt_frame(struct ksignal *ksig, | |||
496 | else | 496 | else |
497 | put_user_ex(0, &frame->uc.uc_flags); | 497 | put_user_ex(0, &frame->uc.uc_flags); |
498 | put_user_ex(0, &frame->uc.uc_link); | 498 | put_user_ex(0, &frame->uc.uc_link); |
499 | err |= __compat_save_altstack(&frame->uc.uc_stack, regs->sp); | 499 | compat_save_altstack_ex(&frame->uc.uc_stack, regs->sp); |
500 | put_user_ex(0, &frame->uc.uc__pad0); | 500 | put_user_ex(0, &frame->uc.uc__pad0); |
501 | 501 | ||
502 | if (ksig->ka.sa.sa_flags & SA_RESTORER) { | 502 | if (ksig->ka.sa.sa_flags & SA_RESTORER) { |