Skip to content

Commit 97ceddb

Browse files
MQ-mengqingchenhuacai
authored andcommitted
LoongArch: Set unwind stack type to unknown rather than set error flag
During unwinding, unwind_done() is used as an end condition. Normally it unwind to the user stack and then set the stack type to unknown, which is a normal exit. When something unexpected happens in unwind process and we cannot unwind anymore, we should set the error flag, and also set the stack type to unknown to indicate that the unwind process can not continue. The error flag emphasizes that the unwind process produce an unexpected error. There is no unexpected things when we unwind the PT_REGS in the top of IRQ stack and find out that is an user mode PT_REGS. Thus, we should not set error flag and just set stack type to unknown. Reported-by: Hengqi Chen <[email protected]> Acked-by: Hengqi Chen <[email protected]> Signed-off-by: Jinyang He <[email protected]> Signed-off-by: Huacai Chen <[email protected]>
1 parent 8146c5b commit 97ceddb

File tree

3 files changed

+2
-3
lines changed

3 files changed

+2
-3
lines changed

arch/loongarch/kernel/stacktrace.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ void arch_stack_walk(stack_trace_consume_fn consume_entry, void *cookie,
3232
}
3333

3434
for (unwind_start(&state, task, regs);
35-
!unwind_done(&state) && !unwind_error(&state); unwind_next_frame(&state)) {
35+
!unwind_done(&state); unwind_next_frame(&state)) {
3636
addr = unwind_get_return_address(&state);
3737
if (!addr || !consume_entry(cookie, addr))
3838
break;

arch/loongarch/kernel/unwind.c

-1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,5 @@ bool default_next_frame(struct unwind_state *state)
2828

2929
} while (!get_stack_info(state->sp, state->task, info));
3030

31-
state->error = true;
3231
return false;
3332
}

arch/loongarch/kernel/unwind_prologue.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ static bool next_frame(struct unwind_state *state)
227227
} while (!get_stack_info(state->sp, state->task, info));
228228

229229
out:
230-
state->error = true;
230+
state->stack_info.type = STACK_TYPE_UNKNOWN;
231231
return false;
232232
}
233233

0 commit comments

Comments
 (0)