The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* include/linux/fortify-string.h:414:4: error: call to '__read_overflow' declared with 'error' attribute: detected read beyond size of object (1st parameter)
@ 2023-02-07 18:59 kernel test robot
  2023-02-07 19:02 ` Nathan Chancellor
  0 siblings, 1 reply; 3+ messages in thread
From: kernel test robot @ 2023-02-07 18:59 UTC (permalink / raw)
  To: Patrisious Haddad
  Cc: llvm, oe-kbuild-all, linux-kernel, Leon Romanovsky, Mark Zhang

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   05ecb680708a1dbe6554d6fc17e5d9a8a7cb5e6a
commit: 925d046e7e52c71c3531199ce137e141807ef740 RDMA/core: Add a netevent notifier to cma
date:   8 months ago
config: mips-buildonly-randconfig-r006-20230207 (https://download.01.org/0day-ci/archive/20230208/202302080231.ZqOmpanX-lkp@intel.com/config)
compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project db0e6591612b53910a1b366863348bdb9d7d2fb1)
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
        # install mips cross compiling tool for clang build
        # apt-get install binutils-mips-linux-gnu
        # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=925d046e7e52c71c3531199ce137e141807ef740
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout 925d046e7e52c71c3531199ce137e141807ef740
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=mips olddefconfig
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=mips SHELL=/bin/bash drivers/infiniband/

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

All errors (new ones prefixed by >>):

   In file included from drivers/infiniband/core/cma.c:9:
   In file included from include/linux/completion.h:12:
   In file included from include/linux/swait.h:7:
   In file included from include/linux/spinlock.h:55:
   In file included from include/linux/preempt.h:78:
   In file included from ./arch/mips/include/generated/asm/preempt.h:1:
   In file included from include/asm-generic/preempt.h:5:
   In file included from include/linux/thread_info.h:60:
   In file included from arch/mips/include/asm/thread_info.h:16:
   In file included from arch/mips/include/asm/processor.h:15:
   In file included from include/linux/cpumask.h:12:
   In file included from include/linux/bitmap.h:11:
   In file included from include/linux/string.h:253:
>> include/linux/fortify-string.h:414:4: error: call to '__read_overflow' declared with 'error' attribute: detected read beyond size of object (1st parameter)
                           __read_overflow();
                           ^
   1 error generated.


vim +414 include/linux/fortify-string.h

a28a6e860c6cf2 Francis Laniel 2021-02-25  405  
92df138a8d663c Kees Cook      2022-02-08  406  __FORTIFY_INLINE __diagnose_as(__builtin_memcmp, 1, 2, 3)
281d0c962752fb Kees Cook      2022-02-08  407  int memcmp(const void * const POS0 p, const void * const POS0 q, __kernel_size_t size)
a28a6e860c6cf2 Francis Laniel 2021-02-25  408  {
a28a6e860c6cf2 Francis Laniel 2021-02-25  409  	size_t p_size = __builtin_object_size(p, 0);
a28a6e860c6cf2 Francis Laniel 2021-02-25  410  	size_t q_size = __builtin_object_size(q, 0);
a28a6e860c6cf2 Francis Laniel 2021-02-25  411  
a28a6e860c6cf2 Francis Laniel 2021-02-25  412  	if (__builtin_constant_p(size)) {
a28a6e860c6cf2 Francis Laniel 2021-02-25  413  		if (p_size < size)
a28a6e860c6cf2 Francis Laniel 2021-02-25 @414  			__read_overflow();
a28a6e860c6cf2 Francis Laniel 2021-02-25  415  		if (q_size < size)
a28a6e860c6cf2 Francis Laniel 2021-02-25  416  			__read_overflow2();
a28a6e860c6cf2 Francis Laniel 2021-02-25  417  	}
a28a6e860c6cf2 Francis Laniel 2021-02-25  418  	if (p_size < size || q_size < size)
a28a6e860c6cf2 Francis Laniel 2021-02-25  419  		fortify_panic(__func__);
a28a6e860c6cf2 Francis Laniel 2021-02-25  420  	return __underlying_memcmp(p, q, size);
a28a6e860c6cf2 Francis Laniel 2021-02-25  421  }
a28a6e860c6cf2 Francis Laniel 2021-02-25  422  

:::::: The code at line 414 was first introduced by commit
:::::: a28a6e860c6cf231cf3c5171c75c342adcd00406 string.h: move fortified functions definitions in a dedicated header.

:::::: TO: Francis Laniel <laniel_francis@privacyrequired.com>
:::::: CC: Linus Torvalds <torvalds@linux-foundation.org>

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests

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

* Re: include/linux/fortify-string.h:414:4: error: call to '__read_overflow' declared with 'error' attribute: detected read beyond size of object (1st parameter)
  2023-02-07 18:59 include/linux/fortify-string.h:414:4: error: call to '__read_overflow' declared with 'error' attribute: detected read beyond size of object (1st parameter) kernel test robot
@ 2023-02-07 19:02 ` Nathan Chancellor
  2023-02-08  8:48   ` Yujie Liu
  0 siblings, 1 reply; 3+ messages in thread
From: Nathan Chancellor @ 2023-02-07 19:02 UTC (permalink / raw)
  To: kernel test robot
  Cc: Patrisious Haddad, llvm, oe-kbuild-all, linux-kernel,
	Leon Romanovsky, Mark Zhang

On Wed, Feb 08, 2023 at 02:59:05AM +0800, kernel test robot wrote:
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head:   05ecb680708a1dbe6554d6fc17e5d9a8a7cb5e6a
> commit: 925d046e7e52c71c3531199ce137e141807ef740 RDMA/core: Add a netevent notifier to cma
> date:   8 months ago
> config: mips-buildonly-randconfig-r006-20230207 (https://download.01.org/0day-ci/archive/20230208/202302080231.ZqOmpanX-lkp@intel.com/config)
> compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project db0e6591612b53910a1b366863348bdb9d7d2fb1)
> 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
>         # install mips cross compiling tool for clang build
>         # apt-get install binutils-mips-linux-gnu
>         # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=925d046e7e52c71c3531199ce137e141807ef740
>         git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
>         git fetch --no-tags linus master
>         git checkout 925d046e7e52c71c3531199ce137e141807ef740
>         # save the config file
>         mkdir build_dir && cp config build_dir/.config
>         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=mips olddefconfig
>         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=mips SHELL=/bin/bash drivers/infiniband/
> 
> If you fix the issue, kindly add following tag where applicable
> | Reported-by: kernel test robot <lkp@intel.com>
> 
> All errors (new ones prefixed by >>):
> 
>    In file included from drivers/infiniband/core/cma.c:9:
>    In file included from include/linux/completion.h:12:
>    In file included from include/linux/swait.h:7:
>    In file included from include/linux/spinlock.h:55:
>    In file included from include/linux/preempt.h:78:
>    In file included from ./arch/mips/include/generated/asm/preempt.h:1:
>    In file included from include/asm-generic/preempt.h:5:
>    In file included from include/linux/thread_info.h:60:
>    In file included from arch/mips/include/asm/thread_info.h:16:
>    In file included from arch/mips/include/asm/processor.h:15:
>    In file included from include/linux/cpumask.h:12:
>    In file included from include/linux/bitmap.h:11:
>    In file included from include/linux/string.h:253:
> >> include/linux/fortify-string.h:414:4: error: call to '__read_overflow' declared with 'error' attribute: detected read beyond size of object (1st parameter)
>                            __read_overflow();
>                            ^
>    1 error generated.

This is tentatively a bug in clang, although I do not see KASAN enabled:

https://github.com/ClangBuiltLinux/linux/issues/1687

I do see CONFIG_UBSAN_BOOL=y though, so this could be a generic
sanitizer problem.

Cheers,
Nathan

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

* Re: include/linux/fortify-string.h:414:4: error: call to '__read_overflow' declared with 'error' attribute: detected read beyond size of object (1st parameter)
  2023-02-07 19:02 ` Nathan Chancellor
@ 2023-02-08  8:48   ` Yujie Liu
  0 siblings, 0 replies; 3+ messages in thread
From: Yujie Liu @ 2023-02-08  8:48 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: kernel test robot, Patrisious Haddad, llvm, oe-kbuild-all,
	linux-kernel, Leon Romanovsky, Mark Zhang

On Tue, Feb 07, 2023 at 12:02:10PM -0700, Nathan Chancellor wrote:
> On Wed, Feb 08, 2023 at 02:59:05AM +0800, kernel test robot wrote:
> > tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> > head:   05ecb680708a1dbe6554d6fc17e5d9a8a7cb5e6a
> > commit: 925d046e7e52c71c3531199ce137e141807ef740 RDMA/core: Add a netevent notifier to cma
> > date:   8 months ago
> > config: mips-buildonly-randconfig-r006-20230207 (https://download.01.org/0day-ci/archive/20230208/202302080231.ZqOmpanX-lkp@intel.com/config)
> > compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project db0e6591612b53910a1b366863348bdb9d7d2fb1)
> > 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
> >         # install mips cross compiling tool for clang build
> >         # apt-get install binutils-mips-linux-gnu
> >         # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=925d046e7e52c71c3531199ce137e141807ef740
> >         git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
> >         git fetch --no-tags linus master
> >         git checkout 925d046e7e52c71c3531199ce137e141807ef740
> >         # save the config file
> >         mkdir build_dir && cp config build_dir/.config
> >         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=mips olddefconfig
> >         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=mips SHELL=/bin/bash drivers/infiniband/
> > 
> > If you fix the issue, kindly add following tag where applicable
> > | Reported-by: kernel test robot <lkp@intel.com>
> > 
> > All errors (new ones prefixed by >>):
> > 
> >    In file included from drivers/infiniband/core/cma.c:9:
> >    In file included from include/linux/completion.h:12:
> >    In file included from include/linux/swait.h:7:
> >    In file included from include/linux/spinlock.h:55:
> >    In file included from include/linux/preempt.h:78:
> >    In file included from ./arch/mips/include/generated/asm/preempt.h:1:
> >    In file included from include/asm-generic/preempt.h:5:
> >    In file included from include/linux/thread_info.h:60:
> >    In file included from arch/mips/include/asm/thread_info.h:16:
> >    In file included from arch/mips/include/asm/processor.h:15:
> >    In file included from include/linux/cpumask.h:12:
> >    In file included from include/linux/bitmap.h:11:
> >    In file included from include/linux/string.h:253:
> > >> include/linux/fortify-string.h:414:4: error: call to '__read_overflow' declared with 'error' attribute: detected read beyond size of object (1st parameter)
> >                            __read_overflow();
> >                            ^
> >    1 error generated.
> 
> This is tentatively a bug in clang, although I do not see KASAN enabled:
> 
> https://github.com/ClangBuiltLinux/linux/issues/1687
> 
> I do see CONFIG_UBSAN_BOOL=y though, so this could be a generic
> sanitizer problem.
> 
> Cheers,
> Nathan

New rule added to the bot and will send similar reports to llvm list only.

Thanks,
Yujie

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

end of thread, other threads:[~2023-02-08  8:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-07 18:59 include/linux/fortify-string.h:414:4: error: call to '__read_overflow' declared with 'error' attribute: detected read beyond size of object (1st parameter) kernel test robot
2023-02-07 19:02 ` Nathan Chancellor
2023-02-08  8:48   ` Yujie Liu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox