diff options
author | Andy Lutomirski <luto@kernel.org> | 2018-11-19 23:45:27 +0100 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2018-11-20 08:44:28 +0100 |
commit | dae0a10593007d049ea71601357ac41d4f247ee9 (patch) | |
tree | 7ce8a6b10d6c767647f121beee058e1c602af701 /arch/x86/mm/fault.c | |
parent | x86/fault: Check user_mode(regs) when avoiding an mmap_sem deadlock (diff) | |
download | linux-dae0a10593007d049ea71601357ac41d4f247ee9.tar.xz linux-dae0a10593007d049ea71601357ac41d4f247ee9.zip |
x86/cpufeatures, x86/fault: Mark SMAP as disabled when configured out
Add X86_FEATURE_SMAP to the disabled features mask as appropriate
and use cpu_feature_enabled() in the fault code. This lets us get
rid of a redundant IS_ENABLED(CONFIG_X86_SMAP).
Signed-off-by: Andy Lutomirski <luto@kernel.org>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Rik van Riel <riel@surriel.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Yu-cheng Yu <yu-cheng.yu@intel.com>
Link: http://lkml.kernel.org/r/fe93332eded3d702f0b0b4cf83928d6830739ba3.1542667307.git.luto@kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'arch/x86/mm/fault.c')
-rw-r--r-- | arch/x86/mm/fault.c | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c index 8624cb7d8d65..39e39cd42097 100644 --- a/arch/x86/mm/fault.c +++ b/arch/x86/mm/fault.c @@ -1150,10 +1150,7 @@ static int fault_in_kernel_space(unsigned long address) static inline bool smap_violation(int error_code, struct pt_regs *regs) { - if (!IS_ENABLED(CONFIG_X86_SMAP)) - return false; - - if (!static_cpu_has(X86_FEATURE_SMAP)) + if (!cpu_feature_enabled(X86_FEATURE_SMAP)) return false; if (error_code & X86_PF_USER) |