ARM: unwind: use ex_frame with CONFIG_UNWINDER_FRAME_POINTER
PATCH 1/1 ARM: unwind: use ex_frame with CONFIG_UNWINDER_FRAME_POINTER
From: guo ziliang <[email protected]>
We define ex_frame with CONFIG_UNWINDER_FRAME_POINTER in struct stackframe, struct stackframe
{
......
#ifdef CONFIG_UNWINDER_FRAME_POINTER
bool ex_frame;#endif
};
but we just use ex_frame without CONFIG_UNWINDER_FRAME_POINTER in return_address() and unwind_frame().
Maybe we should fix it.
--- arch/arm/kernel/return_address.c | 2 ++ arch/arm/kernel/stacktrace.c | 4 ++++ 2 files changed, 6 insertions(+)
arch/arm/kernel/return_address.c +2 -0
@@ -47,7 +47,9 @@ void *return_address(unsigned int level) frame.kr_cur =NULL ; frame.tsk = current;#endif +#ifdef CONFIG_UNWINDER_FRAME_POINTER frame.ex_frame = false; +#endif walk_stackframe (&frame, save_return_addr, &data);
arch/arm/kernel/stacktrace.c +4 -0
@@ -82,6 +82,7 @@ int notrace unwind_frame(struct stackframe *frame)if (frame_pointer_check (frame))return -EINVAL ; +#ifdef CONFIG_UNWINDER_FRAME_POINTER /* * When we unwind through an exception stack, include the saved PC * value into the stack trace.
@@ -102,6 +103,7 @@ int notrace unwind_frame(struct stackframe *frame) frame->ex_frame = false; return 0; } +#endif /* restore the registers from the stack frame */ #ifdef CONFIG_CC_IS_CLANG
@@ -119,8 +121,10 @@ int notrace unwind_frame(struct stackframe *frame) (void *)frame->fp, &frame->kr_cur);#endif +#ifdef CONFIG_UNWINDER_FRAME_POINTER if (in_entry_text (frame->pc)) frame->ex_frame = true; +#endif return 0 ; }
Signature · 1 line
1.8.3.1
Quoted 8 lines · On Thu, May 18, 2023 at 10:58 AM <[email protected]> wrote:
From: guo ziliang <[email protected]>
We define
ex_framewithCONFIG_UNWINDER_FRAME_POINTERin struct stackframe, struct stackframe{ ...... #ifdef CONFIG_UNWINDER_FRAME_POINTER bool ex_frame;
Quoted 7 lines
#endif
};
but we just useex_framewithoutCONFIG_UNWINDER_FRAME_POINTERinreturn_address()andunwind_frame().
Maybe we should fix it.Signed-off-by guo ziliang <[email protected]>
Looks reasonable:
Is it possible to create a .config which expose this problem? Then mention in the commit message "if you select A and B then compilation fails..."
Yours,
Linus Walleij
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel