Introduce [compat_]save_altstack_ex() to unbreak x86 SMAP
authorAl Viro <viro@ZenIV.linux.org.uk>
Sun, 1 Sep 2013 19:35:01 +0000 (20:35 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 27 Sep 2013 00:21:43 +0000 (17:21 -0700)
commit462a44f4919fc83a948ce5c88c2c1d216d8b5bf4
treee5245d3f8836bea4112726b12de52e49d43d9e49
parent727e55b113cd0b4500303dd7c0dbaccd01dad8d3
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>
arch/x86/ia32/ia32_signal.c
arch/x86/kernel/signal.c
include/linux/compat.h
include/linux/signal.h