Skip to contentSkip to conversation

riscv: Fix KASAN memory mapping.

PATCH In review Nylon Chen 2 participants 2 messages Jan 13, 2021 – Jan 14, 2021

Subsystems (2)
lore
Share & tools
lore

Nylon Chen

author
#0 lore raw

PATCH 1/1 riscv: Fix KASAN memory mapping.

From: Nick Hu <[email protected]>

Use virtual address instead of physical address when translating the address to shadow memory by kasan_mem_to_shadow().

---
 arch/riscv/mm/kasan_init.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/riscv/mm/kasan_init.c +2 -2
index 12ddd1f6bf70..a8a2ffd9114a 100644
@@ -93,8 +93,8 @@ void __init kasan_init(void)
 								VMALLOC_END));
 
 	for_each_mem_range(i, &_start, &_end) {
-		void *start = (void *)_start;
-		void *end = (void *)_end;
+		void *start = (void *)__va(_start);
+		void *end = (void *)__va(_end);
 
 		if (start >= end)
 			break;
Signature · 7 lines
2.17.1


_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv
maintainer
#1 lore raw
Quoted 16 lines · On Tue, 12 Jan 2021 18:24:10 PST (-0800), [email protected] wrote:

From: Nick Hu <[email protected]>

Use virtual address instead of physical address when translating the address to shadow memory by kasan_mem_to_shadow().

---
 arch/riscv/mm/kasan_init.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/riscv/mm/kasan_init.c +0 -0
index 12ddd1f6bf70..a8a2ffd9114a 100644

arch/riscv/mm/kasan_init.c void __init kasan_init(void) · line 100

Quoted 10 lines
arch/riscv/mm/kasan_init.c +2 -2
@@ -93,8 +93,8 @@ void __init kasan_init(void)
 								VMALLOC_END));
 
 	for_each_mem_range(i, &_start, &_end) {
-		void *start = (void *)_start;
-		void *end = (void *)_end;
+		void *start = (void *)__va(_start);
+		void *end = (void *)__va(_end);
 
 		if (start >= end)
 			break;

Thanks, this is on fixes.

_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv