[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202307121556582695428@zte.com.cn>
Date: Wed, 12 Jul 2023 15:56:58 +0800 (CST)
From: <guo.ziliang@....com.cn>
To: <linus.walleij@...aro.org>, <linux@...linux.org.uk>,
<rmk+kernel@...linux.org.uk>
Cc: <lihuafei1@...wei.com>, <broonie@...nel.org>,
<linux-arm-kernel@...ts.infradead.org>,
<linux-kernel@...r.kernel.org>
Subject: [PATCH linux-next] ARM: unwind: use ex_frame with CONFIG_UNWINDER_FRAME_POINTER
From: guo ziliang <guo.ziliang@....com.cn>
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().
so when we config CONFIG_FRAME_POINTER=y and CONFIG_ARM_UNWIND=n, compile failed:
arch/arm/kernel/stacktrace.c: In function 'unwind_frame':
arch/arm/kernel/stacktrace.c:44:11: error: 'struct stackframe' has no member named 'ex_frame'
if (frame->ex_frame) {
^~
arch/arm/kernel/stacktrace.c:57:8: error: 'struct stackframe' has no member named 'ex_frame'
frame->ex_frame = false;
^~
arch/arm/kernel/stacktrace.c:67:8: error: 'struct stackframe' has no member named 'ex_frame'
frame->ex_frame = true;
^~
Maybe we should fix it.
Signed-off-by: guo ziliang <guo.ziliang@....com.cn>
---
arch/arm/kernel/return_address.c | 2 ++
arch/arm/kernel/stacktrace.c | 4 ++++
2 files changed, 6 insertions(+)
diff --git a/arch/arm/kernel/return_address.c b/arch/arm/kernel/return_address.c
index ac15db6..dae49e7 100644
--- a/arch/arm/kernel/return_address.c
+++ b/arch/arm/kernel/return_address.c
@@ -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);
diff --git a/arch/arm/kernel/stacktrace.c b/arch/arm/kernel/stacktrace.c
index 620aa82..338f552 100644
--- a/arch/arm/kernel/stacktrace.c
+++ b/arch/arm/kernel/stacktrace.c
@@ -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;
}
--
1.8.3.1
Powered by blists - more mailing lists