* [PATCH] um: Prevent KASAN splats in dump_stack()
@ 2022-09-07 10:05 Vincent Whitchurch
2022-09-07 10:29 ` Dmitry Vyukov
0 siblings, 1 reply; 2+ messages in thread
From: Vincent Whitchurch @ 2022-09-07 10:05 UTC (permalink / raw)
To: Richard Weinberger, Anton Ivanov, Johannes Berg
Cc: kernel, Vincent Whitchurch, Patricia Alfonso, Dmitry Vyukov,
Andrey Konovalov, linux-um, linux-kernel
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")
Signed-off-by: Vincent Whitchurch <vincent.whitchurch@axis.com>
---
arch/um/kernel/sysrq.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/um/kernel/sysrq.c b/arch/um/kernel/sysrq.c
index 7452f70d50d0..746715379f12 100644
--- a/arch/um/kernel/sysrq.c
+++ b/arch/um/kernel/sysrq.c
@@ -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);
--
2.34.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] um: Prevent KASAN splats in dump_stack()
2022-09-07 10:05 [PATCH] um: Prevent KASAN splats in dump_stack() Vincent Whitchurch
@ 2022-09-07 10:29 ` Dmitry Vyukov
0 siblings, 0 replies; 2+ messages in thread
From: Dmitry Vyukov @ 2022-09-07 10:29 UTC (permalink / raw)
To: Vincent Whitchurch
Cc: Richard Weinberger, Anton Ivanov, Johannes Berg, kernel,
Patricia Alfonso, Andrey Konovalov, linux-um, linux-kernel
On Wed, 7 Sept 2022 at 12:05, Vincent Whitchurch
<vincent.whitchurch@axis.com> wrote:
>
> 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")
> Signed-off-by: Vincent Whitchurch <vincent.whitchurch@axis.com>
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
> ---
> arch/um/kernel/sysrq.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/arch/um/kernel/sysrq.c b/arch/um/kernel/sysrq.c
> index 7452f70d50d0..746715379f12 100644
> --- a/arch/um/kernel/sysrq.c
> +++ b/arch/um/kernel/sysrq.c
> @@ -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);
> --
> 2.34.1
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-09-07 10:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-07 10:05 [PATCH] um: Prevent KASAN splats in dump_stack() Vincent Whitchurch
2022-09-07 10:29 ` Dmitry Vyukov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®