All of lore.kernel.org
 help / color / mirror / Atom feed
From: Petr Mladek <pmladek@suse.com>
To: kbuild-all@lists.01.org
Subject: Re: [hnaz-mm:master 272/379] lib/vsprintf.c:991:13: warning: variable 'modbuildid' set but not used
Date: Wed, 02 Mar 2022 13:07:29 +0100	[thread overview]
Message-ID: <Yh9eAYwI3+sBIIo7@alley> (raw)
In-Reply-To: <20220301102448.ff9bf910213d705842a2dd45@linux-foundation.org>

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

On Tue 2022-03-01 10:24:48, Andrew Morton wrote:
> On Tue, 1 Mar 2022 20:11:04 +0800 kernel test robot <lkp@intel.com> wrote:
> 
> > tree:   https://github.com/hnaz/linux-mm master
> > head:   a46912c14343fd3269cc133494988af90b377d9f
> > commit: b314f622e664eb263ea03ef7f4580e37146f123f [272/379] kallsyms: enhance %pS/s/b printing when KALLSYSMS is disabled
> > config: arm-eseries_pxa_defconfig (https://download.01.org/0day-ci/archive/20220301/202203012040.uFWGm3My-lkp(a)intel.com/config)
> > compiler: arm-linux-gnueabi-gcc (GCC) 11.2.0
> > reproduce (this is a W=1 build):
> >         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> >         chmod +x ~/bin/make.cross
> >         # https://github.com/hnaz/linux-mm/commit/b314f622e664eb263ea03ef7f4580e37146f123f
> >         git remote add hnaz-mm https://github.com/hnaz/linux-mm
> >         git fetch --no-tags hnaz-mm master
> >         git checkout b314f622e664eb263ea03ef7f4580e37146f123f
> >         # save the config file to linux build tree
> >         mkdir build_dir
> >         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=arm SHELL=/bin/bash
> > 
> > If you fix the issue, kindly add following tag as appropriate
> > Reported-by: kernel test robot <lkp@intel.com>
> > 
> > All warnings (new ones prefixed by >>):
> > 
> >    lib/vsprintf.c: In function 'sprint_module_info':
> > >> lib/vsprintf.c:991:13: warning: variable 'modbuildid' set but not used [-Wunused-but-set-variable]
> >      991 |         int modbuildid = 0;
> >          |             ^~~~~~~~~~
> 
> Do we care about this?  [-Wunused-but-set-variable isn't normally set. 
> Under what circumstances does it get set in your setup?
> 
> I did this:
> 
> --- a/lib/vsprintf.c~kallsyms-enhance-%ps-s-b-printing-when-kallsysms-is-disabled-fix
> +++ a/lib/vsprintf.c
> @@ -988,7 +988,7 @@ static int sprint_module_info(char *buf,
>  	unsigned long base;
>  	int ret = 0;
>  	const char *modname;
> -	int modbuildid = 0;
> +	int modbuildid __maybe_unused = 0;
>  	int len;
>  #if IS_ENABLED(CONFIG_STACKTRACE_BUILD_ID)
>  	const unsigned char *buildid = NULL;

Looks good. I would fix this. I am not sure but I guess that there
are people that try to fix W=1 warnings.

That said, I would prefer to disable the patch "kallsyms: enhance
%pS/s/b printing when KALLSYSMS is disabled" for now. There are
two problems with it:

   + It discloses the base address of loaded modules. I am not sure
     if it is acceptable from the security point of view.

   + It duplicates a lot of code from kallsyms.c. I would like to
     avoid it.

I have pointed out both problems at
https://lore.kernel.org/r/YhzywNowPiQm3IN4(a)alley
I have to admit that they are hidden between less important comments.

Best Regards,
Petr

WARNING: multiple messages have this Message-ID (diff)
From: Petr Mladek <pmladek@suse.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: kernel test robot <lkp@intel.com>,
	Maninder Singh <maninder1.s@samsung.com>,
	kbuild-all@lists.01.org, linux-kernel@vger.kernel.org,
	Johannes Weiner <hannes@cmpxchg.org>,
	Vaneet Narang <v.narang@samsung.com>,
	Linux Memory Management List <linux-mm@kvack.org>,
	Sergey Senozhatsky <senozhatsky@chromium.org>,
	Steven Rostedt <rostedt@goodmis.org>,
	John Ogness <john.ogness@linutronix.de>
Subject: Re: [hnaz-mm:master 272/379] lib/vsprintf.c:991:13: warning: variable 'modbuildid' set but not used
Date: Wed, 2 Mar 2022 13:07:29 +0100	[thread overview]
Message-ID: <Yh9eAYwI3+sBIIo7@alley> (raw)
In-Reply-To: <20220301102448.ff9bf910213d705842a2dd45@linux-foundation.org>

On Tue 2022-03-01 10:24:48, Andrew Morton wrote:
> On Tue, 1 Mar 2022 20:11:04 +0800 kernel test robot <lkp@intel.com> wrote:
> 
> > tree:   https://github.com/hnaz/linux-mm master
> > head:   a46912c14343fd3269cc133494988af90b377d9f
> > commit: b314f622e664eb263ea03ef7f4580e37146f123f [272/379] kallsyms: enhance %pS/s/b printing when KALLSYSMS is disabled
> > config: arm-eseries_pxa_defconfig (https://download.01.org/0day-ci/archive/20220301/202203012040.uFWGm3My-lkp@intel.com/config)
> > compiler: arm-linux-gnueabi-gcc (GCC) 11.2.0
> > reproduce (this is a W=1 build):
> >         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> >         chmod +x ~/bin/make.cross
> >         # https://github.com/hnaz/linux-mm/commit/b314f622e664eb263ea03ef7f4580e37146f123f
> >         git remote add hnaz-mm https://github.com/hnaz/linux-mm
> >         git fetch --no-tags hnaz-mm master
> >         git checkout b314f622e664eb263ea03ef7f4580e37146f123f
> >         # save the config file to linux build tree
> >         mkdir build_dir
> >         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=arm SHELL=/bin/bash
> > 
> > If you fix the issue, kindly add following tag as appropriate
> > Reported-by: kernel test robot <lkp@intel.com>
> > 
> > All warnings (new ones prefixed by >>):
> > 
> >    lib/vsprintf.c: In function 'sprint_module_info':
> > >> lib/vsprintf.c:991:13: warning: variable 'modbuildid' set but not used [-Wunused-but-set-variable]
> >      991 |         int modbuildid = 0;
> >          |             ^~~~~~~~~~
> 
> Do we care about this?  [-Wunused-but-set-variable isn't normally set. 
> Under what circumstances does it get set in your setup?
> 
> I did this:
> 
> --- a/lib/vsprintf.c~kallsyms-enhance-%ps-s-b-printing-when-kallsysms-is-disabled-fix
> +++ a/lib/vsprintf.c
> @@ -988,7 +988,7 @@ static int sprint_module_info(char *buf,
>  	unsigned long base;
>  	int ret = 0;
>  	const char *modname;
> -	int modbuildid = 0;
> +	int modbuildid __maybe_unused = 0;
>  	int len;
>  #if IS_ENABLED(CONFIG_STACKTRACE_BUILD_ID)
>  	const unsigned char *buildid = NULL;

Looks good. I would fix this. I am not sure but I guess that there
are people that try to fix W=1 warnings.

That said, I would prefer to disable the patch "kallsyms: enhance
%pS/s/b printing when KALLSYSMS is disabled" for now. There are
two problems with it:

   + It discloses the base address of loaded modules. I am not sure
     if it is acceptable from the security point of view.

   + It duplicates a lot of code from kallsyms.c. I would like to
     avoid it.

I have pointed out both problems at
https://lore.kernel.org/r/YhzywNowPiQm3IN4@alley
I have to admit that they are hidden between less important comments.

Best Regards,
Petr


  parent reply	other threads:[~2022-03-02 12:07 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-01 12:11 [hnaz-mm:master 272/379] lib/vsprintf.c:991:13: warning: variable 'modbuildid' set but not used kernel test robot
2022-03-01 18:24 ` Andrew Morton
2022-03-01 18:24   ` Andrew Morton
2022-03-01 19:22   ` Matthew Wilcox
2022-03-01 19:22     ` Matthew Wilcox
2022-03-02  9:52     ` John Ogness
2022-03-02  9:52       ` John Ogness
2022-03-02 11:52       ` Petr Mladek
2022-03-02 11:52         ` Petr Mladek
2022-03-02  9:56     ` Petr Mladek
2022-03-02  9:56       ` Petr Mladek
2022-03-02 12:07   ` Petr Mladek [this message]
2022-03-02 12:07     ` Petr Mladek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Yh9eAYwI3+sBIIo7@alley \
    --to=pmladek@suse.com \
    --cc=kbuild-all@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.