2022-04-21 03:25:52

by Palmer Dabbelt

[permalink] [raw]
Subject: [PATCH v1] RISC-V: Move the "Call Trace" to dump_backtrace()

From: Palmer Dabbelt <[email protected]>

Our oopses include "Call Trace:", but in a different place than some
other targets do. This is breaking at least syzkaller, and likely other
bits of tooling that are trying to parse kernel stack traces.

Signed-off-by: Palmer Dabbelt <[email protected]>

---

I'm sort of just dead-reckoning this one based on the syzkaller issues
being reported in
<CACT4Y+ZA7CRNfYgPmi6jHTKD9rwvaJy=nh5Gz_c-PFHq3tuziQ@mail.gmail.com>, I
haven't tested this at all. There's a lot of other stuff here that
arm64 is doing, much of which seems like it could be pulled out into
generic code. I seem to remember having said that before, though...

I've left this as "Call Trace:" after seeing some patches to convert the
arm/ print from "Call trace:" to "Call Trace:". I can't find it again
and I remember it sounding like that wasn't necessary, but since we've
already got the capital I see no reason to change it. That looks to be
the more popular way.

Presumably this will break any tools parsing the current log format, but
given that we've changed it a handful of times and it looks like it's
just blowing up for folks as-is.
---
arch/riscv/kernel/stacktrace.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/riscv/kernel/stacktrace.c b/arch/riscv/kernel/stacktrace.c
index 08d11a53f39e..d5b91c0d1881 100644
--- a/arch/riscv/kernel/stacktrace.c
+++ b/arch/riscv/kernel/stacktrace.c
@@ -108,12 +108,12 @@ static bool print_trace_address(void *arg, unsigned long pc)
noinline void dump_backtrace(struct pt_regs *regs, struct task_struct *task,
const char *loglvl)
{
+ pr_cont("%sCall Trace:\n", loglvl);
walk_stackframe(task, regs, print_trace_address, (void *)loglvl);
}

void show_stack(struct task_struct *task, unsigned long *sp, const char *loglvl)
{
- pr_cont("%sCall Trace:\n", loglvl);
dump_backtrace(NULL, task, loglvl);
}

--
2.34.1