[PATCH v2] um: x86: print RIP with symbol

Richard Weinberger richard.weinberger at gmail.com
Fri May 27 00:06:30 PDT 2022


On Fri, Apr 22, 2022 at 2:06 PM Johannes Berg <johannes at sipsolutions.net> wrote:
>
> From: Johannes Berg <johannes.berg at intel.com>
>
> This is not only nicer to read by default, but also lets
> decode_stacktrace.sh work on it, rather than removing it.
>
> Signed-off-by: Johannes Berg <johannes.berg at intel.com>
> ---
> v2: put back %lx I accidentally dropped looking at x86
> ---
>  arch/x86/um/sysrq_64.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/x86/um/sysrq_64.c b/arch/x86/um/sysrq_64.c
> index 903ad91b624f..ac4ffe4a4396 100644
> --- a/arch/x86/um/sysrq_64.c
> +++ b/arch/x86/um/sysrq_64.c
> @@ -19,7 +19,7 @@ void show_regs(struct pt_regs *regs)
>         print_modules();
>         printk(KERN_INFO "Pid: %d, comm: %.20s %s %s\n", task_pid_nr(current),
>                 current->comm, print_tainted(), init_utsname()->release);
> -       printk(KERN_INFO "RIP: %04lx:[<%016lx>]\n", PT_REGS_CS(regs) & 0xffff,
> +       printk(KERN_INFO "RIP: %04lx:%pS\n", PT_REGS_CS(regs) & 0xffff,
>                PT_REGS_IP(regs));
>         printk(KERN_INFO "RSP: %016lx  EFLAGS: %08lx\n", PT_REGS_SP(regs),
>                PT_REGS_EFLAGS(regs));

This triggers the following warning here with gcc 7.5:

In file included from ./include/linux/kernel.h:29:0,
                from arch/x86/um/sysrq_64.c:7:
arch/x86/um/sysrq_64.c: In function ‘show_regs’:
./include/linux/kern_levels.h:5:18: warning: format ‘%p’ expects
argument of type ‘void *’, but argument 3 has type ‘long unsigned int’
[-Wformat=]
#define KERN_SOH "\001"  /* ASCII Start Of Header */
                 ^
./include/linux/printk.h:418:11: note: in definition of macro
‘printk_index_wrap’
  _p_func(_fmt, ##__VA_ARGS__);    \
          ^~~~
arch/x86/um/sysrq_64.c:22:2: note: in expansion of macro ‘printk’
 printk(KERN_INFO "RIP: %04lx:%pS\n", PT_REGS_CS(regs) & 0xffff,
 ^~~~~~
./include/linux/kern_levels.h:14:19: note: in expansion of macro ‘KERN_SOH’
#define KERN_INFO KERN_SOH "6" /* informational */
                  ^~~~~~~~
arch/x86/um/sysrq_64.c:22:9: note: in expansion of macro ‘KERN_INFO’
 printk(KERN_INFO "RIP: %04lx:%pS\n", PT_REGS_CS(regs) & 0xffff,
        ^~~~~~~~~
arch/x86/um/sysrq_64.c:22:32: note: format string is defined here
 printk(KERN_INFO "RIP: %04lx:%pS\n", PT_REGS_CS(regs) & 0xffff,
                              ~^
                              %ld

-- 
Thanks,
//richard



More information about the linux-um mailing list