All of lore.kernel.org
 help / color / mirror / Atom feed
From: kbuild test robot <lkp@intel.com>
To: Aristeu Rozanski <aris@redhat.com>
Cc: kbuild-all@01.org, linux-kernel@vger.kernel.org,
	"Luis R. Rodriguez" <mcgrof@kernel.org>,
	Kees Cook <keescook@chromium.org>
Subject: Re: [PATCH] sysctl: do not allow a 64bit value write in a 32bit knob
Date: Tue, 28 Aug 2018 15:21:46 +0800	[thread overview]
Message-ID: <201808281519.jErmNJHh%fengguang.wu@intel.com> (raw)
In-Reply-To: <20180827202706.olt3saqjzzzyax6i@redhat.com>

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

Hi Aristeu,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[also build test WARNING on v4.19-rc1 next-20180827]
[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/Aristeu-Rozanski/sysctl-do-not-allow-a-64bit-value-write-in-a-32bit-knob/20180828-043801
config: i386-randconfig-x017-201834 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-16) 7.3.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All warnings (new ones prefixed by >>):

   In file included from include/linux/export.h:45:0,
                    from include/linux/linkage.h:7,
                    from include/linux/kernel.h:7,
                    from include/linux/list.h:9,
                    from include/linux/module.h:9,
                    from kernel/sysctl.c:21:
   kernel/sysctl.c: In function 'do_proc_dointvec_minmax_conv':
   kernel/sysctl.c:2558:14: warning: right shift count >= width of type [-Wshift-count-overflow]
          *lvalp >> (sizeof(int) * 8))
                 ^
   include/linux/compiler.h:58:30: note: in definition of macro '__trace_if'
     if (__builtin_constant_p(!!(cond)) ? !!(cond) :   \
                                 ^~~~
>> kernel/sysctl.c:2556:3: note: in expansion of macro 'if'
      if ((param->min && *param->min > val) ||
      ^~
   kernel/sysctl.c:2558:14: warning: right shift count >= width of type [-Wshift-count-overflow]
          *lvalp >> (sizeof(int) * 8))
                 ^
   include/linux/compiler.h:58:42: note: in definition of macro '__trace_if'
     if (__builtin_constant_p(!!(cond)) ? !!(cond) :   \
                                             ^~~~
>> kernel/sysctl.c:2556:3: note: in expansion of macro 'if'
      if ((param->min && *param->min > val) ||
      ^~
   kernel/sysctl.c:2558:14: warning: right shift count >= width of type [-Wshift-count-overflow]
          *lvalp >> (sizeof(int) * 8))
                 ^
   include/linux/compiler.h:69:16: note: in definition of macro '__trace_if'
      ______r = !!(cond);     \
                   ^~~~
>> kernel/sysctl.c:2556:3: note: in expansion of macro 'if'
      if ((param->min && *param->min > val) ||
      ^~

vim +/if +2556 kernel/sysctl.c

^1da177e Linus Torvalds   2005-04-16  2548  
00b7c339 Amerigo Wang     2010-05-05  2549  static int do_proc_dointvec_minmax_conv(bool *negp, unsigned long *lvalp,
^1da177e Linus Torvalds   2005-04-16  2550  					int *valp,
^1da177e Linus Torvalds   2005-04-16  2551  					int write, void *data)
^1da177e Linus Torvalds   2005-04-16  2552  {
^1da177e Linus Torvalds   2005-04-16  2553  	struct do_proc_dointvec_minmax_conv_param *param = data;
^1da177e Linus Torvalds   2005-04-16  2554  	if (write) {
^1da177e Linus Torvalds   2005-04-16  2555  		int val = *negp ? -*lvalp : *lvalp;
^1da177e Linus Torvalds   2005-04-16 @2556  		if ((param->min && *param->min > val) ||
b79ce51f Aristeu Rozanski 2018-08-27  2557  		    (param->max && *param->max < val) ||
b79ce51f Aristeu Rozanski 2018-08-27  2558  		    *lvalp >> (sizeof(int) * 8))
^1da177e Linus Torvalds   2005-04-16  2559  			return -EINVAL;
^1da177e Linus Torvalds   2005-04-16  2560  		*valp = val;
^1da177e Linus Torvalds   2005-04-16  2561  	} else {
^1da177e Linus Torvalds   2005-04-16  2562  		int val = *valp;
^1da177e Linus Torvalds   2005-04-16  2563  		if (val < 0) {
00b7c339 Amerigo Wang     2010-05-05  2564  			*negp = true;
9a5bc726 Ilya Dryomov     2015-09-09  2565  			*lvalp = -(unsigned long)val;
^1da177e Linus Torvalds   2005-04-16  2566  		} else {
00b7c339 Amerigo Wang     2010-05-05  2567  			*negp = false;
^1da177e Linus Torvalds   2005-04-16  2568  			*lvalp = (unsigned long)val;
^1da177e Linus Torvalds   2005-04-16  2569  		}
^1da177e Linus Torvalds   2005-04-16  2570  	}
^1da177e Linus Torvalds   2005-04-16  2571  	return 0;
^1da177e Linus Torvalds   2005-04-16  2572  }
^1da177e Linus Torvalds   2005-04-16  2573  

:::::: The code at line 2556 was first introduced by commit
:::::: 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 Linux-2.6.12-rc2

:::::: TO: Linus Torvalds <torvalds@ppc970.osdl.org>
:::::: CC: Linus Torvalds <torvalds@ppc970.osdl.org>

---
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: 30993 bytes --]

      parent reply	other threads:[~2018-08-28  7:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-27 20:27 [PATCH] sysctl: do not allow a 64bit value write in a 32bit knob Aristeu Rozanski
2018-08-28  4:43 ` kbuild test robot
2018-08-28  7:21 ` kbuild test robot [this message]

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=201808281519.jErmNJHh%fengguang.wu@intel.com \
    --to=lkp@intel.com \
    --cc=aris@redhat.com \
    --cc=kbuild-all@01.org \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mcgrof@kernel.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.