lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202210011241.lezLs3sI-lkp@intel.com>
Date:   Sat, 1 Oct 2022 12:31:54 +0800
From:   kernel test robot <lkp@...el.com>
To:     Kees Cook <keescook@...omium.org>
Cc:     kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org,
        Gwan-gyeong Mun <gwan-gyeong.mun@...el.com>
Subject: [kees:devel/hardening 52/69]
 drivers/gpu/drm/i915/i915_user_extensions.c:54:21: error: argument 2 in call
 to function '__builtin_add_overflow' does not have integral type

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git devel/hardening
head:   4b677c85590798c3141758109cc5be7ba068a3ff
commit: b8ff84101ad3b4f8f48a8db4604b72f08c222be2 [52/69] overflow: Introduce overflows_type() and castable_to_type()
config: i386-defconfig
compiler: gcc-11 (Debian 11.3.0-5) 11.3.0
reproduce (this is a W=1 build):
        # https://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git/commit/?id=b8ff84101ad3b4f8f48a8db4604b72f08c222be2
        git remote add kees https://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git
        git fetch --no-tags kees devel/hardening
        git checkout b8ff84101ad3b4f8f48a8db4604b72f08c222be2
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        make W=1 O=build_dir ARCH=i386 SHELL=/bin/bash

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@...el.com>

All errors (new ones prefixed by >>):

   include/linux/overflow.h:134:34: note: in expansion of macro 'type_max'
     134 |                 (x) < 0 || (x) > type_max(typeof(T)) ? 1 : 0    \
         |                                  ^~~~~~~~
   include/linux/overflow.h:159:31: note: in expansion of macro '__overflows_type_constexpr'
     159 |                               __overflows_type_constexpr(n, T), \
         |                               ^~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/i915/i915_user_extensions.c:54:21: note: in expansion of macro 'overflows_type'
      54 |                     overflows_type(next, ext))
         |                     ^~~~~~~~~~~~~~
   include/linux/overflow.h:33:40: error: invalid operands to binary << (have 'struct i915_user_extension *' and 'unsigned int')
      33 | #define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type)))
         |                                        ^~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         |                                                               |
         |                                                               unsigned int
   include/linux/overflow.h:34:53: note: in expansion of macro '__type_half_max'
      34 | #define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T)))
         |                                                     ^~~~~~~~~~~~~~~
   include/linux/overflow.h:134:34: note: in expansion of macro 'type_max'
     134 |                 (x) < 0 || (x) > type_max(typeof(T)) ? 1 : 0    \
         |                                  ^~~~~~~~
   include/linux/overflow.h:159:31: note: in expansion of macro '__overflows_type_constexpr'
     159 |                               __overflows_type_constexpr(n, T), \
         |                               ^~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/i915/i915_user_extensions.c:54:21: note: in expansion of macro 'overflows_type'
      54 |                     overflows_type(next, ext))
         |                     ^~~~~~~~~~~~~~
   include/linux/overflow.h:33:40: error: invalid operands to binary << (have 'struct i915_user_extension *' and 'unsigned int')
      33 | #define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type)))
         |                                        ^~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         |                                                               |
         |                                                               unsigned int
   include/linux/overflow.h:34:27: note: in expansion of macro '__type_half_max'
      34 | #define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T)))
         |                           ^~~~~~~~~~~~~~~
   include/linux/overflow.h:35:30: note: in expansion of macro 'type_max'
      35 | #define type_min(T) ((T)((T)-type_max(T)-(T)1))
         |                              ^~~~~~~~
   include/linux/overflow.h:135:25: note: in expansion of macro 'type_min'
     135 |                 : (x) < type_min(typeof(T)) ||                  \
         |                         ^~~~~~~~
   include/linux/overflow.h:159:31: note: in expansion of macro '__overflows_type_constexpr'
     159 |                               __overflows_type_constexpr(n, T), \
         |                               ^~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/i915/i915_user_extensions.c:54:21: note: in expansion of macro 'overflows_type'
      54 |                     overflows_type(next, ext))
         |                     ^~~~~~~~~~~~~~
   include/linux/overflow.h:33:40: error: invalid operands to binary << (have 'struct i915_user_extension *' and 'unsigned int')
      33 | #define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type)))
         |                                        ^~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         |                                                               |
         |                                                               unsigned int
   include/linux/overflow.h:34:53: note: in expansion of macro '__type_half_max'
      34 | #define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T)))
         |                                                     ^~~~~~~~~~~~~~~
   include/linux/overflow.h:35:30: note: in expansion of macro 'type_max'
      35 | #define type_min(T) ((T)((T)-type_max(T)-(T)1))
         |                              ^~~~~~~~
   include/linux/overflow.h:135:25: note: in expansion of macro 'type_min'
     135 |                 : (x) < type_min(typeof(T)) ||                  \
         |                         ^~~~~~~~
   include/linux/overflow.h:159:31: note: in expansion of macro '__overflows_type_constexpr'
     159 |                               __overflows_type_constexpr(n, T), \
         |                               ^~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/i915/i915_user_extensions.c:54:21: note: in expansion of macro 'overflows_type'
      54 |                     overflows_type(next, ext))
         |                     ^~~~~~~~~~~~~~
   include/linux/overflow.h:33:40: error: invalid operands to binary << (have 'struct i915_user_extension *' and 'unsigned int')
      33 | #define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type)))
         |                                        ^~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         |                                                               |
         |                                                               unsigned int
   include/linux/overflow.h:34:27: note: in expansion of macro '__type_half_max'
      34 | #define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T)))
         |                           ^~~~~~~~~~~~~~~
   include/linux/overflow.h:136:25: note: in expansion of macro 'type_max'
     136 |                   (x) > type_max(typeof(T)) ? 1 : 0)
         |                         ^~~~~~~~
   include/linux/overflow.h:159:31: note: in expansion of macro '__overflows_type_constexpr'
     159 |                               __overflows_type_constexpr(n, T), \
         |                               ^~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/i915/i915_user_extensions.c:54:21: note: in expansion of macro 'overflows_type'
      54 |                     overflows_type(next, ext))
         |                     ^~~~~~~~~~~~~~
   include/linux/overflow.h:33:40: error: invalid operands to binary << (have 'struct i915_user_extension *' and 'unsigned int')
      33 | #define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type)))
         |                                        ^~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         |                                                               |
         |                                                               unsigned int
   include/linux/overflow.h:34:53: note: in expansion of macro '__type_half_max'
      34 | #define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T)))
         |                                                     ^~~~~~~~~~~~~~~
   include/linux/overflow.h:136:25: note: in expansion of macro 'type_max'
     136 |                   (x) > type_max(typeof(T)) ? 1 : 0)
         |                         ^~~~~~~~
   include/linux/overflow.h:159:31: note: in expansion of macro '__overflows_type_constexpr'
     159 |                               __overflows_type_constexpr(n, T), \
         |                               ^~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/i915/i915_user_extensions.c:54:21: note: in expansion of macro 'overflows_type'
      54 |                     overflows_type(next, ext))
         |                     ^~~~~~~~~~~~~~
>> drivers/gpu/drm/i915/i915_user_extensions.c:54:21: error: argument 2 in call to function '__builtin_add_overflow' does not have integral type


vim +/__builtin_add_overflow +54 drivers/gpu/drm/i915/i915_user_extensions.c

9d1305ef80b95d Chris Wilson 2019-03-22  15  
9d1305ef80b95d Chris Wilson 2019-03-22  16  int i915_user_extensions(struct i915_user_extension __user *ext,
9d1305ef80b95d Chris Wilson 2019-03-22  17  			 const i915_user_extension_fn *tbl,
9d1305ef80b95d Chris Wilson 2019-03-22  18  			 unsigned int count,
9d1305ef80b95d Chris Wilson 2019-03-22  19  			 void *data)
9d1305ef80b95d Chris Wilson 2019-03-22  20  {
9d1305ef80b95d Chris Wilson 2019-03-22  21  	unsigned int stackdepth = 512;
9d1305ef80b95d Chris Wilson 2019-03-22  22  
9d1305ef80b95d Chris Wilson 2019-03-22  23  	while (ext) {
9d1305ef80b95d Chris Wilson 2019-03-22  24  		int i, err;
9d1305ef80b95d Chris Wilson 2019-03-22  25  		u32 name;
9d1305ef80b95d Chris Wilson 2019-03-22  26  		u64 next;
9d1305ef80b95d Chris Wilson 2019-03-22  27  
9d1305ef80b95d Chris Wilson 2019-03-22  28  		if (!stackdepth--) /* recursion vs useful flexibility */
9d1305ef80b95d Chris Wilson 2019-03-22  29  			return -E2BIG;
9d1305ef80b95d Chris Wilson 2019-03-22  30  
9d1305ef80b95d Chris Wilson 2019-03-22  31  		err = check_user_mbz(&ext->flags);
9d1305ef80b95d Chris Wilson 2019-03-22  32  		if (err)
9d1305ef80b95d Chris Wilson 2019-03-22  33  			return err;
9d1305ef80b95d Chris Wilson 2019-03-22  34  
9d1305ef80b95d Chris Wilson 2019-03-22  35  		for (i = 0; i < ARRAY_SIZE(ext->rsvd); i++) {
9d1305ef80b95d Chris Wilson 2019-03-22  36  			err = check_user_mbz(&ext->rsvd[i]);
9d1305ef80b95d Chris Wilson 2019-03-22  37  			if (err)
9d1305ef80b95d Chris Wilson 2019-03-22  38  				return err;
9d1305ef80b95d Chris Wilson 2019-03-22  39  		}
9d1305ef80b95d Chris Wilson 2019-03-22  40  
9d1305ef80b95d Chris Wilson 2019-03-22  41  		if (get_user(name, &ext->name))
9d1305ef80b95d Chris Wilson 2019-03-22  42  			return -EFAULT;
9d1305ef80b95d Chris Wilson 2019-03-22  43  
9d1305ef80b95d Chris Wilson 2019-03-22  44  		err = -EINVAL;
9d1305ef80b95d Chris Wilson 2019-03-22  45  		if (name < count) {
9d1305ef80b95d Chris Wilson 2019-03-22  46  			name = array_index_nospec(name, count);
9d1305ef80b95d Chris Wilson 2019-03-22  47  			if (tbl[name])
9d1305ef80b95d Chris Wilson 2019-03-22  48  				err = tbl[name](ext, data);
9d1305ef80b95d Chris Wilson 2019-03-22  49  		}
9d1305ef80b95d Chris Wilson 2019-03-22  50  		if (err)
9d1305ef80b95d Chris Wilson 2019-03-22  51  			return err;
9d1305ef80b95d Chris Wilson 2019-03-22  52  
9d1305ef80b95d Chris Wilson 2019-03-22  53  		if (get_user(next, &ext->next_extension) ||
9d1305ef80b95d Chris Wilson 2019-03-22 @54  		    overflows_type(next, ext))

:::::: The code at line 54 was first introduced by commit
:::::: 9d1305ef80b95dde0337106ed8b826604e2155ad drm/i915: Introduce the i915_user_extension_method

:::::: TO: Chris Wilson <chris@...is-wilson.co.uk>
:::::: CC: Chris Wilson <chris@...is-wilson.co.uk>

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

View attachment "config" of type "text/plain" (132561 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ