printk() format %pS wrong symbol

Valentin Vidić vvidic at valentin-vidic.from.hr
Tue Jul 7 14:39:27 EDT 2020


On Mon, Jul 06, 2020 at 06:06:42PM -0400, William Tambe wrote:
> the issue I am having is due to sprint_backtrace() calling
> __sprint_symbol() with its argument symbol_offset == -1.
> Despite the comment above its definition, it is hard to understand why
> sprint_backtrace() calls __sprint_symbol() that way; in our port it
> results in printing incorrect symbols.
> As a workaround, we have made sprint_backtrace() to be the same as
> sprint_symbol().

>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?

-- 
Valentin



More information about the Kernelnewbies mailing list