On Tue, Jul 07, 2020 at 08:39:27PM +0200, Valentin Vidić wrote:
From what I understand print_backtrace() tries to handle the case when call is the last instruction in a function:
func1: ... ... ... call noret_func3() func2: ... ... ...
Return value on the stack points to the next instruction after the call. But in this case a new function already starts on that address so they add -1 to make the address point back to func1.
Not sure what goes wrong in your case, could you share an example and more info on the port?
This could go wrong if the return address on the stack points to the first instruction of ret_for_syscall: kernel_init: ... ... ... ret_for_syscall: ... <-- return address ... ... In this case kernel_init would be printed instead. Not sure how this address would end up on the stack unless ret_for_syscall is placed directly on the stack for some reason? -- Valentin