x86, smap: Add STAC and CLAC instructions to control user space access
authorH. Peter Anvin <hpa@linux.intel.com>
Fri, 21 Sep 2012 19:43:12 +0000 (12:43 -0700)
committerH. Peter Anvin <hpa@linux.intel.com>
Fri, 21 Sep 2012 19:45:27 +0000 (12:45 -0700)
commit63bcff2a307b9bcc712a8251eb27df8b2e117967
tree0a23a378d2c967edf63e9bb2b5df2288bf30859c
parenta052858fabb376b695f2c125633daa6728e0f284
x86, smap: Add STAC and CLAC instructions to control user space access

When Supervisor Mode Access Prevention (SMAP) is enabled, access to
userspace from the kernel is controlled by the AC flag.  To make the
performance of manipulating that flag acceptable, there are two new
instructions, STAC and CLAC, to set and clear it.

This patch adds those instructions, via alternative(), when the SMAP
feature is enabled.  It also adds X86_EFLAGS_AC unconditionally to the
SYSCALL entry mask; there is simply no reason to make that one
conditional.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Link: http://lkml.kernel.org/r/1348256595-29119-9-git-send-email-hpa@linux.intel.com
14 files changed:
arch/x86/ia32/ia32entry.S
arch/x86/include/asm/fpu-internal.h
arch/x86/include/asm/futex.h
arch/x86/include/asm/smap.h
arch/x86/include/asm/uaccess.h
arch/x86/include/asm/xsave.h
arch/x86/kernel/cpu/common.c
arch/x86/kernel/entry_64.S
arch/x86/lib/copy_user_64.S
arch/x86/lib/copy_user_nocache_64.S
arch/x86/lib/getuser.S
arch/x86/lib/putuser.S
arch/x86/lib/usercopy_32.c
arch/x86/lib/usercopy_64.c