From: Ira Weiny <ira.we...@intel.com>

PKey faults may now happen on kernel mappings if the feature is enabled.
Remove the warning in the fault path if PKS is enabled.

Reviewed-by: Dan Williams <dan.j.willi...@intel.com>
Signed-off-by: Ira Weiny <ira.we...@intel.com>
---
 arch/x86/mm/fault.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c
index a73347e2cdfc..731ec90ed413 100644
--- a/arch/x86/mm/fault.c
+++ b/arch/x86/mm/fault.c
@@ -1141,11 +1141,12 @@ do_kern_addr_fault(struct pt_regs *regs, unsigned long 
hw_error_code,
                   unsigned long address)
 {
        /*
-        * Protection keys exceptions only happen on user pages.  We
-        * have no user pages in the kernel portion of the address
-        * space, so do not expect them here.
+        * PF_PK is expected on kernel addresses when supervisor pkeys are
+        * enabled.
         */
-       WARN_ON_ONCE(hw_error_code & X86_PF_PK);
+       if (!cpu_feature_enabled(X86_FEATURE_PKS))
+               WARN_ON_ONCE(hw_error_code & X86_PF_PK);
+
 
 #ifdef CONFIG_X86_32
        /*
-- 
2.28.0.rc0.12.gb6a658bd00c9

Reply via email to