|
@@ -1001,6 +1001,12 @@ 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))
|
|
|
+ return false;
|
|
|
+
|
|
|
if (error_code & PF_USER)
|
|
|
return false;
|
|
|
|
|
@@ -1087,11 +1093,9 @@ __do_page_fault(struct pt_regs *regs, unsigned long error_code)
|
|
|
if (unlikely(error_code & PF_RSVD))
|
|
|
pgtable_bad(regs, error_code, address);
|
|
|
|
|
|
- if (static_cpu_has(X86_FEATURE_SMAP)) {
|
|
|
- if (unlikely(smap_violation(error_code, regs))) {
|
|
|
- bad_area_nosemaphore(regs, error_code, address);
|
|
|
- return;
|
|
|
- }
|
|
|
+ if (unlikely(smap_violation(error_code, regs))) {
|
|
|
+ bad_area_nosemaphore(regs, error_code, address);
|
|
|
+ return;
|
|
|
}
|
|
|
|
|
|
/*
|