Skip to contentSkip to conversation

parisc: Add KFENCE support

PATCH Helge Deller 1 participant 1 message May 3, 2021

Subsystems (2)
lore
Share & tools
lore

Helge Deller

author maintainer
#0 lore raw

---

arch/parisc/Kconfig +3 -2
index afc3b8d03572..e4a6ae388eb3 100644
@@ -47,6 +47,7 @@ config PARISC
 	select HAVE_ARCH_HASH
 	select HAVE_ARCH_JUMP_LABEL
 	select HAVE_ARCH_JUMP_LABEL_RELATIVE
+	select HAVE_ARCH_KFENCE
 	select HAVE_ARCH_SECCOMP_FILTER
 	select HAVE_ARCH_TRACEHOOK
 	select HAVE_REGS_AND_STACK_ACCESS_API
@@ -257,11 +258,11 @@ config PARISC_PAGE_SIZE_4KB
 
 config PARISC_PAGE_SIZE_16KB
 	bool "16KB"
-	depends on PA8X00 && BROKEN
+	depends on PA8X00 && BROKEN && !KFENCE
 
 config PARISC_PAGE_SIZE_64KB
 	bool "64KB"
-	depends on PA8X00 && BROKEN
+	depends on PA8X00 && BROKEN && !KFENCE
 
 endchoice
 
arch/parisc/include/asm/kfence.h new file +45 -0

45 lines not on this page · raw message

arch/parisc/mm/fault.c +5 -0
index 716960f5d92e..ae4398ba0b7d 100644
@@ -19,6 +19,7 @@
 #include <linux/uaccess.h>
 #include <linux/hugetlb.h>
 #include <linux/perf_event.h>
+#include <linux/kfence.h>
 
 #include <asm/traps.h>
 
@@ -416,6 +417,10 @@ void do_page_fault(struct pt_regs *regs, unsigned long code,
 		return;
 	}
 
+	if (!user_mode(regs) &&
+	    kfence_handle_page_fault(address, flags & FAULT_FLAG_WRITE, regs))
+		return;
+
 	parisc_terminate("Bad Address (null pointer deref?)", regs, code, address);
 
   out_of_memory: