From: Maninder Singh <maninder1.s@samsung.com>
To: "linux@armlinux.org.uk" <linux@armlinux.org.uk>,
"nathan@kernel.org" <nathan@kernel.org>,
"nick.desaulniers+lkml@gmail.com"
<nick.desaulniers+lkml@gmail.com>,
"morbo@google.com" <morbo@google.com>,
"justinstitt@google.com" <justinstitt@google.com>
Cc: Onkarnath <onkarnath.1@samsung.com>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"llvm@lists.linux.dev" <llvm@lists.linux.dev>,
Rohit Thapliyal <r.thapliyal@samsung.com>
Subject: RE: [PATCH 1/1] arm: backtrace-clang: fix wrong sp usage for unwinding
Date: Wed, 29 Jul 2026 09:11:01 +0530 [thread overview]
Message-ID: <20260729034101epcms5p4ac85b52aef78052cbc03d5913a7300b5@epcms5p4> (raw)
In-Reply-To: <CGME20260729034101epcms5p4ac85b52aef78052cbc03d5913a7300b5@epcms5p4>
Ping! Any comments?
> show_stack() can be called for any task, however c_backtrace always unwinds
> frames based on the "sp" register. This results in printing the backtrace of
> the current task instead of the target task.
>
> Try with normal TC:
> ==================
> for_each_process(p) {
> sched_show_task(p);
> }
>
> [7.433271] task:kthreadd state:S stack:0 pid:2 tgid:2 ppid:0 task_flags:0x208040 flags:0x00000000
> [7.433633] Call trace:
> [7.433640] [<80113418>] (dump_backtrace) from [<80113510>] (show_stack+0x14/0x18)
> ..
> [7.433676] [<8016749c>] (sched_show_task) from [<803cb324>] (meminfo_proc_show+0x6c/0x930)
> [7.434019] r5:8158e300 r4:8b4882d0
> [7.434024] [<803cb324>] (meminfo_proc_show) from [<80365788>] (seq_read_iter+0x148/0x4bc)
> [7.434045] [<80365788>] (seq_read_iter) from [<803c044c>] (proc_reg_read_iter+0xb8/0xc4)
> [7.434060] [<803c044c>] (proc_reg_read_iter) from [<80377104>] (copy_splice_read+0x228/0x308)
>
> It should unwind frame based on passed "fp".
> (CONFIG_UNWINDER_FRAME_POINTER=y)
>
> With fix:
> =========
> [13.933732] task:kthreadd state:S stack:0 pid:2 tgid:2 ppid:0 task_flags:0x208040 flags:0x00000000
> [13.934165] Call trace:
> [13.934604] [<80afa1a8>] (schedule) from [<8015426c>] (kthreadd+0x124/0x208)
> [13.934654] r10:8100bbf0 r4:8116f440
> [13.934664] [<8015426c>] (kthreadd) from [<8010010c>] (ret_from_fork+0x14/0x28)
> [13.934691] Exception stack(0xf081df9c to 0xf081dfe4)
>
> Additionally, the extra manipulation of "sp" register appears unnecessary in the "current"
> task also since the "fp" register is already provided.
>
> Signed-off-by: Onkarnath
> Signed-off-by: Maninder Singh
> ---
> arch/arm/lib/backtrace-clang.S | 4 ----
> 1 file changed, 4 deletions(-)
>
> diff --git a/arch/arm/lib/backtrace-clang.S b/arch/arm/lib/backtrace-clang.S
> index 290c52a60fc6..993410a6afd1 100644
> --- a/arch/arm/lib/backtrace-clang.S
> +++ b/arch/arm/lib/backtrace-clang.S
> @@ -105,10 +105,6 @@ ENDPROC(c_backtrace)
> moveq mask, #0xfc000003
> movne mask, #0 @ mask for 32-bit
>
> -/*
> - * Switches the current frame to be the frame for dump_stack.
> - */
> - add frame, sp, #24 @ switch to false frame
> for_each_frame: tst frame, mask @ Check for address exceptions
> bne no_frame
>
> --
> 2.34.1
next parent reply other threads:[~2026-07-29 3:41 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20260729034101epcms5p4ac85b52aef78052cbc03d5913a7300b5@epcms5p4>
2026-07-29 3:41 ` Maninder Singh [this message]
2026-08-03 18:22 ` Nathan Chancellor
2026-08-04 16:38 ` Ard Biesheuvel
[not found] ` <CGME20260729034101epcms5p4ac85b52aef78052cbc03d5913a7300b5@epcms5p8>
2026-08-05 3:59 ` Maninder Singh
[not found] <CGME20260624054927epcas5p3f8e7be966570a89e722cc718475320fa@epcas5p3.samsung.com>
2026-06-24 5:49 ` Maninder Singh
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=20260729034101epcms5p4ac85b52aef78052cbc03d5913a7300b5@epcms5p4 \
--to=maninder1.s@samsung.com \
--cc=justinstitt@google.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=llvm@lists.linux.dev \
--cc=morbo@google.com \
--cc=nathan@kernel.org \
--cc=nick.desaulniers+lkml@gmail.com \
--cc=onkarnath.1@samsung.com \
--cc=r.thapliyal@samsung.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: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®