DORMANTno replies

[PATCH 6/6] arm/mm/ptdump:Add address markers for KASAN regions

From: Hailong liu <hidden>
Date: 2021-01-19 18:28:52
Also in: lkml
Subsystem: arm port, the rest · Maintainers: Russell King, Linus Torvalds

From: Hailong Liu <redacted>

ARM has recently supported KASAN, so I think that it's time to add KASAN
regions for PTDUMP on ARM.

I have tested this patch with QEMU + vexpress-a15. Both CONFIG_ARM_LPAE
and no CONFIG_ARM_LPAE.

The result after patching looks like this:
1 CONFIG_ARM_LPAE=y
---[ Kasan shadow start ]---
0x6ee00000-0x7af00000         193M     RW NX SHD MEM/CACHED/WBWA
0x7b000000-0x7f000000          64M     ro NX SHD MEM/CACHED/WBWA
---[ Kasan shadow end ]---
---[ Modules ]---
---[ Kernel Mapping ]---
......
---[ vmalloc() Area ]---
......
---[ vmalloc() End ]---
---[ Fixmap Area ]---
---[ Vectors ]---
......
---[ Vectors End ]---

Signed-off-by: Hailong Liu <redacted>
---
 arch/arm/mm/dump.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/arch/arm/mm/dump.c b/arch/arm/mm/dump.c
index c18d23a5e5f1..93ff0097f00b 100644
--- a/arch/arm/mm/dump.c
+++ b/arch/arm/mm/dump.c
@@ -19,6 +19,10 @@
 #include <asm/ptdump.h>
 
 static struct addr_marker address_markers[] = {
+#ifdef CONFIG_KASAN
+	{ KASAN_SHADOW_START,	"Kasan shadow start"},
+	{ KASAN_SHADOW_END,	"Kasan shadow end"},
+#endif
 	{ MODULES_VADDR,	"Modules" },
 	{ PAGE_OFFSET,		"Kernel Mapping" },
 	{ 0,			"vmalloc() Area" },
@@ -429,8 +433,11 @@ static void ptdump_initialize(void)
 				if (pg_level[i].bits[j].nx_bit)
 					pg_level[i].nx_bit = &pg_level[i].bits[j];
 			}
-
+#ifdef CONFIG_KASAN
+	address_markers[4].start_address = VMALLOC_START;
+#else
 	address_markers[2].start_address = VMALLOC_START;
+#endif
 }
 
 static struct ptdump_info kernel_ptdump_info = {
-- 
2.17.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help