All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0001/0001] format idle IP output func+offset/length
@ 2017-11-06  5:25 Liu, Changcheng
  2017-11-06  8:05 ` Sergey Senozhatsky
                   ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Liu, Changcheng @ 2017-11-06  5:25 UTC (permalink / raw)
  To: Sergey Senozhatsky, jpoimboe, Petr Mladek, changcheng.liu
  Cc: Andrew Morton, linux-kernel

kaslr feature is enabled in kernel.
Remove kernel text address when dumping idle IP info

Signed-off-by: Liu Changcheng <changcheng.liu@intel.com>
Signed-off-by: Jerry Liu <primerlink@gmail.com>

diff --git a/lib/nmi_backtrace.c b/lib/nmi_backtrace.c
index 0bc0a35..9cc4178 100644
--- a/lib/nmi_backtrace.c
+++ b/lib/nmi_backtrace.c
@@ -92,7 +92,7 @@ bool nmi_cpu_backtrace(struct pt_regs *regs)
 	if (cpumask_test_cpu(cpu, to_cpumask(backtrace_mask))) {
 		arch_spin_lock(&lock);
 		if (regs && cpu_in_idle(instruction_pointer(regs))) {
-			pr_warn("NMI backtrace for cpu %d skipped: idling at pc %#lx\n",
+			pr_warn("NMI backtrace for cpu %d skipped: idling at pc %pS\n",
 				cpu, instruction_pointer(regs));
 		} else {
 			pr_warn("NMI backtrace for cpu %d\n", cpu);
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH 0001/0001] format idle IP output func+offset/length
  2017-11-06  5:25 [PATCH 0001/0001] format idle IP output func+offset/length Liu, Changcheng
@ 2017-11-06  8:05 ` Sergey Senozhatsky
  2017-11-06 10:52   ` Liu, Changcheng
  2017-11-09  3:10 ` [PATCH 0001/0001] format idle IP output func+offset/length kbuild test robot
  2017-11-09  3:21 ` kbuild test robot
  2 siblings, 1 reply; 13+ messages in thread
From: Sergey Senozhatsky @ 2017-11-06  8:05 UTC (permalink / raw)
  To: Liu, Changcheng
  Cc: Sergey Senozhatsky, jpoimboe, Petr Mladek, Andrew Morton, linux-kernel

On (11/06/17 13:25), Liu, Changcheng wrote:
> kaslr feature is enabled in kernel.
> Remove kernel text address when dumping idle IP info
> 
> Signed-off-by: Liu Changcheng <changcheng.liu@intel.com>
> Signed-off-by: Jerry Liu <primerlink@gmail.com>
> 
> diff --git a/lib/nmi_backtrace.c b/lib/nmi_backtrace.c
> index 0bc0a35..9cc4178 100644
> --- a/lib/nmi_backtrace.c
> +++ b/lib/nmi_backtrace.c
> @@ -92,7 +92,7 @@ bool nmi_cpu_backtrace(struct pt_regs *regs)
>  	if (cpumask_test_cpu(cpu, to_cpumask(backtrace_mask))) {
>  		arch_spin_lock(&lock);
>  		if (regs && cpu_in_idle(instruction_pointer(regs))) {
> -			pr_warn("NMI backtrace for cpu %d skipped: idling at pc %#lx\n",
> +			pr_warn("NMI backtrace for cpu %d skipped: idling at pc %pS\n",
		       I guess the word 'pc' can be dropped from the message ^^

there seems to be other cases in the kernel when we print regs->pc/regs->ip.

	-ss

>  				cpu, instruction_pointer(regs));
>  		} else {
>  			pr_warn("NMI backtrace for cpu %d\n", cpu);

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 0001/0001] format idle IP output func+offset/length
  2017-11-06  8:05 ` Sergey Senozhatsky
@ 2017-11-06 10:52   ` Liu, Changcheng
  2017-11-06 12:15     ` Petr Mladek
  2017-11-06 13:11     ` Josh Poimboeuf
  0 siblings, 2 replies; 13+ messages in thread
From: Liu, Changcheng @ 2017-11-06 10:52 UTC (permalink / raw)
  To: Sergey Senozhatsky, jpoimboe, Petr Mladek, changcheng.liu
  Cc: Andrew Morton, linux-kernel

kaslr feature is enabled in kernel.
Remove kernel text address when dumping idle IP info

Signed-off-by: Liu Changcheng <changcheng.liu@intel.com>
Signed-off-by: Jerry Liu <primerlink@gmail.com>

diff --git a/lib/nmi_backtrace.c b/lib/nmi_backtrace.c
index 0bc0a35..9cc4178 100644
--- a/lib/nmi_backtrace.c
+++ b/lib/nmi_backtrace.c
@@ -92,7 +92,7 @@ bool nmi_cpu_backtrace(struct pt_regs *regs)
 	if (cpumask_test_cpu(cpu, to_cpumask(backtrace_mask))) {
 		arch_spin_lock(&lock);
 		if (regs && cpu_in_idle(instruction_pointer(regs))) {
-			pr_warn("NMI backtrace for cpu %d skipped: idling at pc %#lx\n",
+			pr_warn("NMI backtrace for cpu %d skipped: idling at %pS\n",
 				cpu, instruction_pointer(regs));
 		} else {
 			pr_warn("NMI backtrace for cpu %d\n", cpu);
-- 
2.7.4

On 17:05 Mon 06 Nov, Sergey Senozhatsky wrote:
> On (11/06/17 13:25), Liu, Changcheng wrote:
> > kaslr feature is enabled in kernel.
> > Remove kernel text address when dumping idle IP info
> > 
> > Signed-off-by: Liu Changcheng <changcheng.liu@intel.com>
> > Signed-off-by: Jerry Liu <primerlink@gmail.com>
> > 
> > diff --git a/lib/nmi_backtrace.c b/lib/nmi_backtrace.c
> > index 0bc0a35..9cc4178 100644
> > --- a/lib/nmi_backtrace.c
> > +++ b/lib/nmi_backtrace.c
> > @@ -92,7 +92,7 @@ bool nmi_cpu_backtrace(struct pt_regs *regs)
> >  	if (cpumask_test_cpu(cpu, to_cpumask(backtrace_mask))) {
> >  		arch_spin_lock(&lock);
> >  		if (regs && cpu_in_idle(instruction_pointer(regs))) {
> > -			pr_warn("NMI backtrace for cpu %d skipped: idling at pc %#lx\n",
> > +			pr_warn("NMI backtrace for cpu %d skipped: idling at pc %pS\n",
> 		       I guess the word 'pc' can be dropped from the message ^^
> 
> there seems to be other cases in the kernel when we print regs->pc/regs->ip.
> 
> 	-ss
> 
> >  				cpu, instruction_pointer(regs));
> >  		} else {
> >  			pr_warn("NMI backtrace for cpu %d\n", cpu);

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH 0001/0001] format idle IP output func+offset/length
  2017-11-06 10:52   ` Liu, Changcheng
@ 2017-11-06 12:15     ` Petr Mladek
  2017-11-06 13:11     ` Josh Poimboeuf
  1 sibling, 0 replies; 13+ messages in thread
From: Petr Mladek @ 2017-11-06 12:15 UTC (permalink / raw)
  To: Liu, Changcheng; +Cc: Sergey Senozhatsky, jpoimboe, Andrew Morton, linux-kernel

On Mon 2017-11-06 18:52:03, Liu, Changcheng wrote:
> kaslr feature is enabled in kernel.
> Remove kernel text address when dumping idle IP info
> 
> Signed-off-by: Liu Changcheng <changcheng.liu@intel.com>
> Signed-off-by: Jerry Liu <primerlink@gmail.com>
> 
> diff --git a/lib/nmi_backtrace.c b/lib/nmi_backtrace.c
> index 0bc0a35..9cc4178 100644
> --- a/lib/nmi_backtrace.c
> +++ b/lib/nmi_backtrace.c
> @@ -92,7 +92,7 @@ bool nmi_cpu_backtrace(struct pt_regs *regs)
>  	if (cpumask_test_cpu(cpu, to_cpumask(backtrace_mask))) {
>  		arch_spin_lock(&lock);
>  		if (regs && cpu_in_idle(instruction_pointer(regs))) {
> -			pr_warn("NMI backtrace for cpu %d skipped: idling at pc %#lx\n",
> +			pr_warn("NMI backtrace for cpu %d skipped: idling at %pS\n",

Yup, removing "pc" makes sense as well.

Reviewed-by: Petr Mladek <pmladek@suse.com>

Best Regards,
Petr

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 0001/0001] format idle IP output func+offset/length
  2017-11-06 10:52   ` Liu, Changcheng
  2017-11-06 12:15     ` Petr Mladek
@ 2017-11-06 13:11     ` Josh Poimboeuf
  2017-11-06 16:48       ` Liu, Changcheng
  1 sibling, 1 reply; 13+ messages in thread
From: Josh Poimboeuf @ 2017-11-06 13:11 UTC (permalink / raw)
  To: Liu, Changcheng
  Cc: Sergey Senozhatsky, Petr Mladek, Andrew Morton, linux-kernel

On Mon, Nov 06, 2017 at 06:52:03PM +0800, Liu, Changcheng wrote:
> kaslr feature is enabled in kernel.
> Remove kernel text address when dumping idle IP info
> 
> Signed-off-by: Liu Changcheng <changcheng.liu@intel.com>
> Signed-off-by: Jerry Liu <primerlink@gmail.com>
> 
> diff --git a/lib/nmi_backtrace.c b/lib/nmi_backtrace.c
> index 0bc0a35..9cc4178 100644
> --- a/lib/nmi_backtrace.c
> +++ b/lib/nmi_backtrace.c
> @@ -92,7 +92,7 @@ bool nmi_cpu_backtrace(struct pt_regs *regs)
>  	if (cpumask_test_cpu(cpu, to_cpumask(backtrace_mask))) {
>  		arch_spin_lock(&lock);
>  		if (regs && cpu_in_idle(instruction_pointer(regs))) {
> -			pr_warn("NMI backtrace for cpu %d skipped: idling at pc %#lx\n",
> +			pr_warn("NMI backtrace for cpu %d skipped: idling at %pS\n",
>  				cpu, instruction_pointer(regs));
>  		} else {
>  			pr_warn("NMI backtrace for cpu %d\n", cpu);

1) The patch introduces a compile warning.

2) When posting a new version of the patch, it should have a new version
   in the subject, e.g. "PATCH v2".

3) The subject is missing a prefix, like "lib_backtrace: "

4) The subject isn't very clear, how about something like:

   lib_backtrace: fix kernel text address leak

5) The description isn't correct.  KASLR isn't always enabled, it
   depends on the user's config.  But even without KASLR, we don't want
   to leak kernel text addresses.

6) The description should use complete sentences.

7) I'm not sure the "Signed-off-by:" chain is correct.  Was Jerry Liu
   the original author of the patch?

-- 
Josh

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 0001/0001] format idle IP output func+offset/length
  2017-11-06 13:11     ` Josh Poimboeuf
@ 2017-11-06 16:48       ` Liu, Changcheng
  2017-11-06 16:56         ` [PATCH v2] lib_backtrace: fix kernel text address leak Liu, Changcheng
  0 siblings, 1 reply; 13+ messages in thread
From: Liu, Changcheng @ 2017-11-06 16:48 UTC (permalink / raw)
  To: Josh Poimboeuf, Petr Mladek, changcheng.liu
  Cc: sergey.senozhatsky.work, Andrew Morton, linux-kernel

Thx Josh. I'll refine the patch.
Answer question as below.

On 07:11 Mon 06 Nov, Josh Poimboeuf wrote:
> On Mon, Nov 06, 2017 at 06:52:03PM +0800, Liu, Changcheng wrote:
> > kaslr feature is enabled in kernel.
> > Remove kernel text address when dumping idle IP info
> > 
> > Signed-off-by: Liu Changcheng <changcheng.liu@intel.com>
> > Signed-off-by: Jerry Liu <primerlink@gmail.com>
> > 
> > diff --git a/lib/nmi_backtrace.c b/lib/nmi_backtrace.c
> > index 0bc0a35..9cc4178 100644
> > --- a/lib/nmi_backtrace.c
> > +++ b/lib/nmi_backtrace.c
> > @@ -92,7 +92,7 @@ bool nmi_cpu_backtrace(struct pt_regs *regs)
> >  	if (cpumask_test_cpu(cpu, to_cpumask(backtrace_mask))) {
> >  		arch_spin_lock(&lock);
> >  		if (regs && cpu_in_idle(instruction_pointer(regs))) {
> > -			pr_warn("NMI backtrace for cpu %d skipped: idling at pc %#lx\n",
> > +			pr_warn("NMI backtrace for cpu %d skipped: idling at %pS\n",
> >  				cpu, instruction_pointer(regs));
> >  		} else {
> >  			pr_warn("NMI backtrace for cpu %d\n", cpu);
> 
> 1) The patch introduces a compile warning.
I've got the point because the conversion between pointer and unsigned long.
> 
> 2) When posting a new version of the patch, it should have a new version
>    in the subject, e.g. "PATCH v2".
Thx for your guide. I'm on the way to work with community.
> 
> 3) The subject is missing a prefix, like "lib_backtrace: "
> 
> 4) The subject isn't very clear, how about something like:
> 
>    lib_backtrace: fix kernel text address leak
I'll use this subject.
> 
> 5) The description isn't correct.  KASLR isn't always enabled, it
>    depends on the user's config.  But even without KASLR, we don't want
>    to leak kernel text addresses.
That's fine.
> 
> 6) The description should use complete sentences.
Yes.
> 
> 7) I'm not sure the "Signed-off-by:" chain is correct.  Was Jerry Liu
>    the original author of the patch?
This is my personal bad habit. I'll correct it.
> 
> -- 
> Josh

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2] lib_backtrace: fix kernel text address leak
  2017-11-06 16:48       ` Liu, Changcheng
@ 2017-11-06 16:56         ` Liu, Changcheng
  2017-11-06 17:14           ` Josh Poimboeuf
  0 siblings, 1 reply; 13+ messages in thread
From: Liu, Changcheng @ 2017-11-06 16:56 UTC (permalink / raw)
  To: Josh Poimboeuf, Petr Mladek, Sergey Senozhatsky, changcheng.liu
  Cc: Andrew Morton, linux-kernel

Don't leak idle function address in NMI backtrace.

Signed-off-by: Liu Changcheng <changcheng.liu@intel.com>

diff --git a/lib/nmi_backtrace.c b/lib/nmi_backtrace.c
index 46e4c749..61a6b5a 100644
--- a/lib/nmi_backtrace.c
+++ b/lib/nmi_backtrace.c
@@ -93,8 +93,8 @@ bool nmi_cpu_backtrace(struct pt_regs *regs)
 	if (cpumask_test_cpu(cpu, to_cpumask(backtrace_mask))) {
 		arch_spin_lock(&lock);
 		if (regs && cpu_in_idle(instruction_pointer(regs))) {
-			pr_warn("NMI backtrace for cpu %d skipped: idling at pc %#lx\n",
-				cpu, instruction_pointer(regs));
+			pr_warn("NMI backtrace for cpu %d skipped: idling at %pS\n",
+				cpu, (void *)instruction_pointer(regs));
 		} else {
 			pr_warn("NMI backtrace for cpu %d\n", cpu);
 			if (regs)
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH v2] lib_backtrace: fix kernel text address leak
  2017-11-06 16:56         ` [PATCH v2] lib_backtrace: fix kernel text address leak Liu, Changcheng
@ 2017-11-06 17:14           ` Josh Poimboeuf
  0 siblings, 0 replies; 13+ messages in thread
From: Josh Poimboeuf @ 2017-11-06 17:14 UTC (permalink / raw)
  To: Liu, Changcheng
  Cc: Petr Mladek, Sergey Senozhatsky, Andrew Morton, linux-kernel

On Tue, Nov 07, 2017 at 12:56:48AM +0800, Liu, Changcheng wrote:
> Don't leak idle function address in NMI backtrace.
> 
> Signed-off-by: Liu Changcheng <changcheng.liu@intel.com>
> 
> diff --git a/lib/nmi_backtrace.c b/lib/nmi_backtrace.c
> index 46e4c749..61a6b5a 100644
> --- a/lib/nmi_backtrace.c
> +++ b/lib/nmi_backtrace.c
> @@ -93,8 +93,8 @@ bool nmi_cpu_backtrace(struct pt_regs *regs)
>  	if (cpumask_test_cpu(cpu, to_cpumask(backtrace_mask))) {
>  		arch_spin_lock(&lock);
>  		if (regs && cpu_in_idle(instruction_pointer(regs))) {
> -			pr_warn("NMI backtrace for cpu %d skipped: idling at pc %#lx\n",
> -				cpu, instruction_pointer(regs));
> +			pr_warn("NMI backtrace for cpu %d skipped: idling at %pS\n",
> +				cpu, (void *)instruction_pointer(regs));
>  		} else {
>  			pr_warn("NMI backtrace for cpu %d\n", cpu);
>  			if (regs)

Sorry, I had a typo in my suggestion.  The subject prefix should be:
"nmi_backtrace" instead of "lib_backtrace".

Also, when posting a followup patch, please remove the "Re: " from the
subject so that it's clear that it's a new patch, and not a comment for
the old one.

Otherwise it looks great to me.  Thanks!

-- 
Josh

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 0001/0001] format idle IP output func+offset/length
  2017-11-06  5:25 [PATCH 0001/0001] format idle IP output func+offset/length Liu, Changcheng
  2017-11-06  8:05 ` Sergey Senozhatsky
@ 2017-11-09  3:10 ` kbuild test robot
  2017-11-09  3:29   ` Liu, Changcheng
  2017-11-09  3:21 ` kbuild test robot
  2 siblings, 1 reply; 13+ messages in thread
From: kbuild test robot @ 2017-11-09  3:10 UTC (permalink / raw)
  To: Liu, Changcheng
  Cc: kbuild-all, Sergey Senozhatsky, jpoimboe, Petr Mladek,
	changcheng.liu, Andrew Morton, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 2371 bytes --]

Hi Changcheng,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[also build test WARNING on v4.14-rc8]
[cannot apply to next-20171108]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Liu-Changcheng/format-idle-IP-output-func-offset-length/20171109-100035
config: i386-randconfig-x074-201745 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All warnings (new ones prefixed by >>):

   In file included from include/linux/printk.h:7:0,
                    from include/linux/kernel.h:14,
                    from include/linux/cpumask.h:10,
                    from lib/nmi_backtrace.c:16:
   lib/nmi_backtrace.c: In function 'nmi_cpu_backtrace':
>> 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/kern_levels.h:12:22: note: in expansion of macro 'KERN_SOH'
    #define KERN_WARNING KERN_SOH "4" /* warning conditions */
                         ^~~~~~~~
   include/linux/printk.h:304:9: note: in expansion of macro 'KERN_WARNING'
     printk(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
            ^~~~~~~~~~~~
   include/linux/printk.h:305:17: note: in expansion of macro 'pr_warning'
    #define pr_warn pr_warning
                    ^~~~~~~~~~
>> lib/nmi_backtrace.c:96:4: note: in expansion of macro 'pr_warn'
       pr_warn("NMI backtrace for cpu %d skipped: idling at pc %pS\n",
       ^~~~~~~

vim +/pr_warn +96 lib/nmi_backtrace.c

    87	
    88	bool nmi_cpu_backtrace(struct pt_regs *regs)
    89	{
    90		static arch_spinlock_t lock = __ARCH_SPIN_LOCK_UNLOCKED;
    91		int cpu = smp_processor_id();
    92	
    93		if (cpumask_test_cpu(cpu, to_cpumask(backtrace_mask))) {
    94			arch_spin_lock(&lock);
    95			if (regs && cpu_in_idle(instruction_pointer(regs))) {
  > 96				pr_warn("NMI backtrace for cpu %d skipped: idling at pc %pS\n",

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 24659 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 0001/0001] format idle IP output func+offset/length
  2017-11-06  5:25 [PATCH 0001/0001] format idle IP output func+offset/length Liu, Changcheng
  2017-11-06  8:05 ` Sergey Senozhatsky
  2017-11-09  3:10 ` [PATCH 0001/0001] format idle IP output func+offset/length kbuild test robot
@ 2017-11-09  3:21 ` kbuild test robot
  2 siblings, 0 replies; 13+ messages in thread
From: kbuild test robot @ 2017-11-09  3:21 UTC (permalink / raw)
  To: Liu, Changcheng
  Cc: kbuild-all, Sergey Senozhatsky, jpoimboe, Petr Mladek,
	changcheng.liu, Andrew Morton, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1521 bytes --]

Hi Changcheng,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[also build test WARNING on v4.14-rc8]
[cannot apply to next-20171108]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Liu-Changcheng/format-idle-IP-output-func-offset-length/20171109-100035
config: i386-randconfig-n0-11080844 (attached as .config)
compiler: gcc-4.8 (Debian 4.8.4-1) 4.8.4
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All warnings (new ones prefixed by >>):

   lib/nmi_backtrace.c: In function 'nmi_cpu_backtrace':
>> lib/nmi_backtrace.c:96:4: warning: format '%p' expects argument of type 'void *', but argument 3 has type 'long unsigned int' [-Wformat=]
       pr_warn("NMI backtrace for cpu %d skipped: idling at pc %pS\n",
       ^

vim +96 lib/nmi_backtrace.c

    87	
    88	bool nmi_cpu_backtrace(struct pt_regs *regs)
    89	{
    90		static arch_spinlock_t lock = __ARCH_SPIN_LOCK_UNLOCKED;
    91		int cpu = smp_processor_id();
    92	
    93		if (cpumask_test_cpu(cpu, to_cpumask(backtrace_mask))) {
    94			arch_spin_lock(&lock);
    95			if (regs && cpu_in_idle(instruction_pointer(regs))) {
  > 96				pr_warn("NMI backtrace for cpu %d skipped: idling at pc %pS\n",

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 31973 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 0001/0001] format idle IP output func+offset/length
  2017-11-09  3:10 ` [PATCH 0001/0001] format idle IP output func+offset/length kbuild test robot
@ 2017-11-09  3:29   ` Liu, Changcheng
  0 siblings, 0 replies; 13+ messages in thread
From: Liu, Changcheng @ 2017-11-09  3:29 UTC (permalink / raw)
  To: lkp, kbuild-all
  Cc: Sergey Senozhatsky, jpoimboe, Petr Mladek, Andrew Morton,
	linux-kernel, changcheng.liu

Hi 0Day maintainers,
     The right patch is https://lkml.org/lkml/2017/11/6/685
	 I don't know why the original wrong patch is tested again.

B.R.
Changcheng

On 11:10 Thu 09 Nov, kbuild test robot wrote:
> Hi Changcheng,
> 
> Thank you for the patch! Perhaps something to improve:
> 
> [auto build test WARNING on linus/master]
> [also build test WARNING on v4.14-rc8]
> [cannot apply to next-20171108]
> [if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
> 
> url:    https://github.com/0day-ci/linux/commits/Liu-Changcheng/format-idle-IP-output-func-offset-length/20171109-100035
> config: i386-randconfig-x074-201745 (attached as .config)
> compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
> reproduce:
>         # save the attached .config to linux build tree
>         make ARCH=i386 
> 
> All warnings (new ones prefixed by >>):
> 
>    In file included from include/linux/printk.h:7:0,
>                     from include/linux/kernel.h:14,
>                     from include/linux/cpumask.h:10,
>                     from lib/nmi_backtrace.c:16:
>    lib/nmi_backtrace.c: In function 'nmi_cpu_backtrace':
> >> 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/kern_levels.h:12:22: note: in expansion of macro 'KERN_SOH'
>     #define KERN_WARNING KERN_SOH "4" /* warning conditions */
>                          ^~~~~~~~
>    include/linux/printk.h:304:9: note: in expansion of macro 'KERN_WARNING'
>      printk(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
>             ^~~~~~~~~~~~
>    include/linux/printk.h:305:17: note: in expansion of macro 'pr_warning'
>     #define pr_warn pr_warning
>                     ^~~~~~~~~~
> >> lib/nmi_backtrace.c:96:4: note: in expansion of macro 'pr_warn'
>        pr_warn("NMI backtrace for cpu %d skipped: idling at pc %pS\n",
>        ^~~~~~~
> 
> vim +/pr_warn +96 lib/nmi_backtrace.c
> 
>     87	
>     88	bool nmi_cpu_backtrace(struct pt_regs *regs)
>     89	{
>     90		static arch_spinlock_t lock = __ARCH_SPIN_LOCK_UNLOCKED;
>     91		int cpu = smp_processor_id();
>     92	
>     93		if (cpumask_test_cpu(cpu, to_cpumask(backtrace_mask))) {
>     94			arch_spin_lock(&lock);
>     95			if (regs && cpu_in_idle(instruction_pointer(regs))) {
>   > 96				pr_warn("NMI backtrace for cpu %d skipped: idling at pc %pS\n",
> 
> ---
> 0-DAY kernel test infrastructure                Open Source Technology Center
> https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 0001/0001] format idle IP output func+offset/length
  2017-11-06  3:19 Liu, Changcheng
@ 2017-11-06 12:13 ` Petr Mladek
  0 siblings, 0 replies; 13+ messages in thread
From: Petr Mladek @ 2017-11-06 12:13 UTC (permalink / raw)
  To: Liu, Changcheng; +Cc: Sergey Senozhatsky, jpoimboe, Andrew Morton, linux-kernel

On Mon 2017-11-06 11:19:31, Liu, Changcheng wrote:
> kaslr feature is enabled in kernel.
> Remove kernel text address when dumping idle IP info

> diff --git a/lib/nmi_backtrace.c b/lib/nmi_backtrace.c
> index 0bc0a35..9cc4178 100644
> --- a/lib/nmi_backtrace.c
> +++ b/lib/nmi_backtrace.c
> @@ -92,7 +92,7 @@ bool nmi_cpu_backtrace(struct pt_regs *regs)
>     if (cpumask_test_cpu(cpu, to_cpumask(backtrace_mask))) {
>         arch_spin_lock(&lock);
>         if (regs && cpu_in_idle(instruction_pointer(regs))) {
> -           pr_warn("NMI backtrace for cpu %d skipped: idling at pc %#lx\n",
> +           pr_warn("NMI backtrace for cpu %d skipped: idling at pc %pS\n",

Great catch!

Reviewed-by: Petr Mladek <pmladek@suse.com>

Best Regards,
Petr

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH 0001/0001] format idle IP output func+offset/length
@ 2017-11-06  3:19 Liu, Changcheng
  2017-11-06 12:13 ` Petr Mladek
  0 siblings, 1 reply; 13+ messages in thread
From: Liu, Changcheng @ 2017-11-06  3:19 UTC (permalink / raw)
  To: Sergey Senozhatsky, jpoimboe, Petr Mladek; +Cc: Andrew Morton, linux-kernel

kaslr feature is enabled in kernel.
Remove kernel text address when dumping idle IP info

Signed-off-by: Liu Changcheng <changcheng.liu@intel.com>
Signed-off-by: Jerry Liu <primerlink@gmail.com>

diff --git a/lib/nmi_backtrace.c b/lib/nmi_backtrace.c
index 0bc0a35..9cc4178 100644
--- a/lib/nmi_backtrace.c
+++ b/lib/nmi_backtrace.c
@@ -92,7 +92,7 @@ bool nmi_cpu_backtrace(struct pt_regs *regs)
    if (cpumask_test_cpu(cpu, to_cpumask(backtrace_mask))) {
        arch_spin_lock(&lock);
        if (regs && cpu_in_idle(instruction_pointer(regs))) {
-           pr_warn("NMI backtrace for cpu %d skipped: idling at pc %#lx\n",
+           pr_warn("NMI backtrace for cpu %d skipped: idling at pc %pS\n",
                cpu, instruction_pointer(regs));
        } else {
            pr_warn("NMI backtrace for cpu %d\n", cpu);
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2017-11-09  3:29 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-06  5:25 [PATCH 0001/0001] format idle IP output func+offset/length Liu, Changcheng
2017-11-06  8:05 ` Sergey Senozhatsky
2017-11-06 10:52   ` Liu, Changcheng
2017-11-06 12:15     ` Petr Mladek
2017-11-06 13:11     ` Josh Poimboeuf
2017-11-06 16:48       ` Liu, Changcheng
2017-11-06 16:56         ` [PATCH v2] lib_backtrace: fix kernel text address leak Liu, Changcheng
2017-11-06 17:14           ` Josh Poimboeuf
2017-11-09  3:10 ` [PATCH 0001/0001] format idle IP output func+offset/length kbuild test robot
2017-11-09  3:29   ` Liu, Changcheng
2017-11-09  3:21 ` kbuild test robot
  -- strict thread matches above, loose matches on Subject: below --
2017-11-06  3:19 Liu, Changcheng
2017-11-06 12:13 ` Petr Mladek

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.