From: Wang Kai <morgan.wang@huawei.com> To: <rmk+kernel@arm.linux.org.uk>, <k.khlebnikov@samsung.com> Cc: <linux-arm-kernel@lists.infradead.org>, <linux-kernel@vger.kernel.org>, <wangnan0@huawei.com>, <kernel.openeuler@huawei.com> Subject: [PATCH] ARM:stacktrace: make stacktrace skip always right. Date: Thu, 11 Sep 2014 17:02:23 +0800 [thread overview] Message-ID: <1410426143-9455-1-git-send-email-morgan.wang@huawei.com> (raw) This patch is for commit 3683f44c42e991d313dc301504ee0fca1aeb8580, that makes stacktrace NOT begin from stacktrace self function, which are: __save_stack_trace and save_stack_trace. But save_stack_trace will NOT have stacktrace information when build with '-O2', assemble code looks like below: 00000154 <save_stack_trace>: 154: e1a0200d mov r2, sp 158: e1a01000 mov r1, r0 15c: e3c23d7f bic r3, r2, #8128 ; 0x1fc0 160: e3a02000 mov r2, #0 164: e3c3303f bic r3, r3, #63 ; 0x3f 168: e593000c ldr r0, [r3, #12] 16c: eaffffd0 b b4 <__save_stack_trace> In this situation, the "data.skip +=2" operation will skip the last user call function, make user stacktrace strange/incorrect. To fix this, we have to make sure save_stack_trace has stacktrace info, then skip 2 function will be OK. Signed-off-by: Wang Kai <morgan.wang@huawei.com> --- arch/arm/kernel/stacktrace.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/kernel/stacktrace.c b/arch/arm/kernel/stacktrace.c index 6582c4a..1eb1b5ae 100644 --- a/arch/arm/kernel/stacktrace.c +++ b/arch/arm/kernel/stacktrace.c @@ -134,6 +134,7 @@ void save_stack_trace_tsk(struct task_struct *tsk, struct stack_trace *trace) void save_stack_trace(struct stack_trace *trace) { __save_stack_trace(current, trace, 0); + asm volatile("" : : : "memory"); } EXPORT_SYMBOL_GPL(save_stack_trace); #endif -- 1.8.5.5
WARNING: multiple messages have this Message-ID (diff)
From: morgan.wang@huawei.com (Wang Kai) To: linux-arm-kernel@lists.infradead.org Subject: [PATCH] ARM:stacktrace: make stacktrace skip always right. Date: Thu, 11 Sep 2014 17:02:23 +0800 [thread overview] Message-ID: <1410426143-9455-1-git-send-email-morgan.wang@huawei.com> (raw) This patch is for commit 3683f44c42e991d313dc301504ee0fca1aeb8580, that makes stacktrace NOT begin from stacktrace self function, which are: __save_stack_trace and save_stack_trace. But save_stack_trace will NOT have stacktrace information when build with '-O2', assemble code looks like below: 00000154 <save_stack_trace>: 154: e1a0200d mov r2, sp 158: e1a01000 mov r1, r0 15c: e3c23d7f bic r3, r2, #8128 ; 0x1fc0 160: e3a02000 mov r2, #0 164: e3c3303f bic r3, r3, #63 ; 0x3f 168: e593000c ldr r0, [r3, #12] 16c: eaffffd0 b b4 <__save_stack_trace> In this situation, the "data.skip +=2" operation will skip the last user call function, make user stacktrace strange/incorrect. To fix this, we have to make sure save_stack_trace has stacktrace info, then skip 2 function will be OK. Signed-off-by: Wang Kai <morgan.wang@huawei.com> --- arch/arm/kernel/stacktrace.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/kernel/stacktrace.c b/arch/arm/kernel/stacktrace.c index 6582c4a..1eb1b5ae 100644 --- a/arch/arm/kernel/stacktrace.c +++ b/arch/arm/kernel/stacktrace.c @@ -134,6 +134,7 @@ void save_stack_trace_tsk(struct task_struct *tsk, struct stack_trace *trace) void save_stack_trace(struct stack_trace *trace) { __save_stack_trace(current, trace, 0); + asm volatile("" : : : "memory"); } EXPORT_SYMBOL_GPL(save_stack_trace); #endif -- 1.8.5.5
next reply other threads:[~2014-09-11 9:14 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2014-09-11 9:02 Wang Kai [this message] 2014-09-11 9:02 ` [PATCH] ARM:stacktrace: make stacktrace skip always right Wang Kai
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=1410426143-9455-1-git-send-email-morgan.wang@huawei.com \ --to=morgan.wang@huawei.com \ --cc=k.khlebnikov@samsung.com \ --cc=kernel.openeuler@huawei.com \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-kernel@vger.kernel.org \ --cc=rmk+kernel@arm.linux.org.uk \ --cc=wangnan0@huawei.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.