[PATCH V4 06/10] x86/fault: Adjust WARN_ON for PKey fault

From
<hidden>
Date
2021-03-22 05:31:23
Also in
linux-kselftest, lkml
Reply to
unknown sender, 2021-03-22
From: Ira Weiny <redacted>

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 <redacted>
Signed-off-by: Ira Weiny <redacted>
---
 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
Thread (16 messages) 16 messages, 2 authors, last reply 2021-03-30
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help