Skip to contentSkip to conversation

um: Prevent KASAN splats in dump_stack()

PATCH In review Vincent Whitchurch 2 participants 2 messages Sep 7, 2022 User-mode Linux (UML)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 um: Prevent KASAN splats in dump_stack()

Use READ_ONCE_NOCHECK() when reading the stack to prevent KASAN splats when dump_stack() is used.

Fixes 5b301409e8bc5d7fad ("UML: add support for KASAN under x86_64")
---
 arch/um/kernel/sysrq.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
arch/um/kernel/sysrq.c +2 -1
index 7452f70d50d0..746715379f12 100644
@@ -48,7 +48,8 @@ void show_stack(struct task_struct *task, unsigned long *stack,
 			break;
 		if (i && ((i % STACKSLOTS_PER_LINE) == 0))
 			pr_cont("\n");
-		pr_cont(" %08lx", *stack++);
+		pr_cont(" %08lx", READ_ONCE_NOCHECK(*stack));
+		stack++;
 	}
 
 	printk("%sCall Trace:\n", loglvl);
Signature · 7 lines
2.34.1


_______________________________________________
linux-um mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-um
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Vincent Whitchurch

Use READ_ONCE_NOCHECK() when reading the stack to prevent KASAN splats when dump_stack() is used.

Fixes 5b301409e8bc5d7fad ("UML: add support for KASAN under x86_64")
Quoted 19 lines
---
 arch/um/kernel/sysrq.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
arch/um/kernel/sysrq.c +2 -2
index 7452f70d50d0..746715379f12 100644
@@ -48,7 +48,8 @@ void show_stack(struct task_struct *task, unsigned long *stack,
                        break;
                if (i && ((i % STACKSLOTS_PER_LINE) == 0))
                        pr_cont("\n");
-               pr_cont(" %08lx", *stack++);
+               pr_cont(" %08lx", READ_ONCE_NOCHECK(*stack));
+               stack++;
        }
 
        printk("%sCall Trace:\n", loglvl);
--
Quoted 2 lines

2.34.1

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