This is a note to let you know that I've just added the patch titled LoongArch: Check unwind_error() in arch_stack_walk() to the 6.2-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: loongarch-check-unwind_error-in-arch_stack_walk.patch and it can be found in the queue-6.2 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 370a3b8f58743eceb97c5256538d6048c26d2d03 Mon Sep 17 00:00:00 2001 From: Tiezhu Yang <yangtiezhu@xxxxxxxxxxx> Date: Wed, 19 Apr 2023 12:07:27 +0800 Subject: LoongArch: Check unwind_error() in arch_stack_walk() From: Tiezhu Yang <yangtiezhu@xxxxxxxxxxx> commit 370a3b8f58743eceb97c5256538d6048c26d2d03 upstream. We can see the following messages with CONFIG_PROVE_LOCKING=y on LoongArch: BUG: MAX_STACK_TRACE_ENTRIES too low! turning off the locking correctness validator. This is because stack_trace_save() returns a big value after call arch_stack_walk(), here is the call trace: save_trace() stack_trace_save() arch_stack_walk() stack_trace_consume_entry() arch_stack_walk() should return immediately if unwind_next_frame() failed, no need to do the useless loops to increase the value of c->len in stack_trace_consume_entry(), then we can fix the above problem. Cc: stable@xxxxxxxxxxxxxxx Reported-by: Guenter Roeck <linux@xxxxxxxxxxxx> Link: https://lore.kernel.org/all/8a44ad71-68d2-4926-892f-72bfc7a67e2a@xxxxxxxxxxxx/ Signed-off-by: Tiezhu Yang <yangtiezhu@xxxxxxxxxxx> Signed-off-by: Huacai Chen <chenhuacai@xxxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- arch/loongarch/kernel/stacktrace.c | 2 +- arch/loongarch/kernel/unwind.c | 1 + arch/loongarch/kernel/unwind_prologue.c | 4 +++- 3 files changed, 5 insertions(+), 2 deletions(-) --- a/arch/loongarch/kernel/stacktrace.c +++ b/arch/loongarch/kernel/stacktrace.c @@ -30,7 +30,7 @@ void arch_stack_walk(stack_trace_consume regs->regs[1] = 0; for (unwind_start(&state, task, regs); - !unwind_done(&state); unwind_next_frame(&state)) { + !unwind_done(&state) && !unwind_error(&state); unwind_next_frame(&state)) { addr = unwind_get_return_address(&state); if (!addr || !consume_entry(cookie, addr)) break; --- a/arch/loongarch/kernel/unwind.c +++ b/arch/loongarch/kernel/unwind.c @@ -28,5 +28,6 @@ bool default_next_frame(struct unwind_st } while (!get_stack_info(state->sp, state->task, info)); + state->error = true; return false; } --- a/arch/loongarch/kernel/unwind_prologue.c +++ b/arch/loongarch/kernel/unwind_prologue.c @@ -211,7 +211,7 @@ static bool next_frame(struct unwind_sta pc = regs->csr_era; if (user_mode(regs) || !__kernel_text_address(pc)) - return false; + goto out; state->first = true; state->pc = pc; @@ -226,6 +226,8 @@ static bool next_frame(struct unwind_sta } while (!get_stack_info(state->sp, state->task, info)); +out: + state->error = true; return false; } Patches currently in stable-queue which might be from yangtiezhu@xxxxxxxxxxx are queue-6.2/loongarch-check-unwind_error-in-arch_stack_walk.patch queue-6.2/loongarch-fix-build-error-if-config_suspend-is-not-s.patch