RE: [PATCH 1/1] arm: backtrace-clang: fix wrong sp usage for unwinding

Maninder Singh <[email protected]>
Newsgroups dev.linux.lists.llvm,org.infradead.lists.linux-arm-kernel,org.kernel.vger.linux-kernel
Message-ID <20260805035915epcms5p8b47cc0c9349e1a5178cc6e4c6d3ee918@epcms5p8>
Hi Ard, Nathan

Thanks for checking the patch.

> The existing code does seem to be broken, as the provided frame pointer
> value is ignored entirely.
> 
> However, by removing this add, you are skipping the false frame, which
> was added to ensure that calling c_backtrace() from dump_backtrace()
> does not miss any frames when regs == NULL.
> 
> So I think the correct approach here is to make the add conditional
> on whether frame == fp, which will be the case when c_backtrace()
> is called from dump_backtrace() with a NULL regs argument.
> 
> I.e.,
> 
>   cmp    frame, fp
>   addeq  frame, sp, #24

Initially I thought we can ignore the extra frame, because we will be getting
the backtrace till show_stack().

But "YES" as you said to ensure dump_backtrace() in Backtrace, it should be there.
So I will send the update change.

Tested with your suggestion:

Call trace:
 dump_backtrace from show_stack+0x14/0x18
 show_stack from dump_stack_lvl+0x38/0x74
 dump_stack_lvl from dump_stack+0x14/0x18
 dump_stack from meminfo_proc_show+0x4c/0x908
 meminfo_proc_show from seq_read_iter+0x148/0x4bc


Thanks,

Maninder Singh
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.