All of lore.kernel.org
 help / color / mirror / Atom feed
* [kees:for-next/hardening 28/42] include/linux/refcount.h:141:1: warning: 'no_sanitize' attribute directive ignored
@ 2024-03-10 22:30 kernel test robot
  2024-03-13  3:48 ` Kees Cook
  0 siblings, 1 reply; 2+ messages in thread
From: kernel test robot @ 2024-03-10 22:30 UTC (permalink / raw)
  To: Kees Cook; +Cc: oe-kbuild-all, Miguel Ojeda

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git for-next/hardening
head:   6c069c8d3cfc30c5a399166b6ce63aa42a7d1dac
commit: e697572c09d21678e2e8cc1256af165106fccb7f [28/42] refcount: Annotated intentional signed integer wrap-around
config: um-randconfig-r053-20240310 (https://download.01.org/0day-ci/archive/20240311/202403110643.27JXEVCI-lkp@intel.com/config)
compiler: gcc-7 (Ubuntu 7.5.0-6ubuntu2) 7.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240311/202403110643.27JXEVCI-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202403110643.27JXEVCI-lkp@intel.com/

All warnings (new ones prefixed by >>):

   In file included from include/linux/crypto.h:16:0,
                    from arch/x86/um/shared/sysdep/kernel-offsets.h:5,
                    from arch/um/kernel/asm-offsets.c:1:
>> include/linux/refcount.h:141:1: warning: 'no_sanitize' attribute directive ignored [-Wattributes]
    {
    ^
   include/linux/refcount.h:183:1: warning: 'no_sanitize' attribute directive ignored [-Wattributes]
    {
    ^
   include/linux/refcount.h:263:1: warning: 'no_sanitize' attribute directive ignored [-Wattributes]
    {
    ^
--
   In file included from include/linux/kref.h:17:0,
                    from include/linux/mm_types.h:8,
                    from include/linux/mmzone.h:22,
                    from include/linux/gfp.h:7,
                    from include/linux/umh.h:4,
                    from include/linux/kmod.h:9,
                    from include/linux/module.h:17,
                    from drivers/clk/clkdev.c:9:
>> include/linux/refcount.h:141:1: warning: 'no_sanitize' attribute directive ignored [-Wattributes]
    {
    ^
   include/linux/refcount.h:183:1: warning: 'no_sanitize' attribute directive ignored [-Wattributes]
    {
    ^
   include/linux/refcount.h:263:1: warning: 'no_sanitize' attribute directive ignored [-Wattributes]
    {
    ^
   drivers/clk/clkdev.c: In function 'vclkdev_alloc':
   drivers/clk/clkdev.c:173:3: warning: function 'vclkdev_alloc' might be a candidate for 'gnu_printf' format attribute [-Wsuggest-attribute=format]
      vscnprintf(cla->dev_id, sizeof(cla->dev_id), dev_fmt, ap);
      ^~~~~~~~~~
--
   In file included from include/linux/crypto.h:16:0,
                    from arch/x86/um/shared/sysdep/kernel-offsets.h:5,
                    from arch/um/kernel/asm-offsets.c:1:
>> include/linux/refcount.h:141:1: warning: 'no_sanitize' attribute directive ignored [-Wattributes]
    {
    ^
   include/linux/refcount.h:183:1: warning: 'no_sanitize' attribute directive ignored [-Wattributes]
    {
    ^
   include/linux/refcount.h:263:1: warning: 'no_sanitize' attribute directive ignored [-Wattributes]
    {
    ^
--
   In file included from include/linux/crypto.h:16:0,
                    from arch/x86/um/shared/sysdep/kernel-offsets.h:5,
                    from arch/um/kernel/asm-offsets.c:1:
>> include/linux/refcount.h:141:1: warning: 'no_sanitize' attribute directive ignored [-Wattributes]
    {
    ^
   include/linux/refcount.h:183:1: warning: 'no_sanitize' attribute directive ignored [-Wattributes]
    {
    ^
   include/linux/refcount.h:263:1: warning: 'no_sanitize' attribute directive ignored [-Wattributes]
    {
    ^


vim +/no_sanitize +141 include/linux/refcount.h

fb041bb7c0a918 Will Deacon    2019-11-21  138  
e697572c09d216 Kees Cook      2024-02-20  139  static inline __must_check __signed_wrap
e697572c09d216 Kees Cook      2024-02-20  140  bool __refcount_add_not_zero(int i, refcount_t *r, int *oldp)
77e9971c79c295 Will Deacon    2019-11-21 @141  {
dcb786493f3e48 Will Deacon    2019-11-21  142  	int old = refcount_read(r);
afed7bcf9487bb Mark Rutland   2018-07-11  143  
77e9971c79c295 Will Deacon    2019-11-21  144  	do {
dcb786493f3e48 Will Deacon    2019-11-21  145  		if (!old)
dcb786493f3e48 Will Deacon    2019-11-21  146  			break;
dcb786493f3e48 Will Deacon    2019-11-21  147  	} while (!atomic_try_cmpxchg_relaxed(&r->refs, &old, old + i));
f405df5de3170c Peter Zijlstra 2016-11-14  148  
a435b9a1435658 Peter Zijlstra 2020-07-29  149  	if (oldp)
a435b9a1435658 Peter Zijlstra 2020-07-29  150  		*oldp = old;
a435b9a1435658 Peter Zijlstra 2020-07-29  151  
1eb085d94256aa Will Deacon    2019-11-21  152  	if (unlikely(old < 0 || old + i < 0))
1eb085d94256aa Will Deacon    2019-11-21  153  		refcount_warn_saturate(r, REFCOUNT_ADD_NOT_ZERO_OVF);
77e9971c79c295 Will Deacon    2019-11-21  154  
dcb786493f3e48 Will Deacon    2019-11-21  155  	return old;
77e9971c79c295 Will Deacon    2019-11-21  156  }
77e9971c79c295 Will Deacon    2019-11-21  157  

:::::: The code at line 141 was first introduced by commit
:::::: 77e9971c79c29542ab7dd4140f9343bf2ff36158 locking/refcount: Move the bulk of the REFCOUNT_FULL implementation into the <linux/refcount.h> header

:::::: TO: Will Deacon <will@kernel.org>
:::::: CC: Ingo Molnar <mingo@kernel.org>

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

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

* Re: [kees:for-next/hardening 28/42] include/linux/refcount.h:141:1: warning: 'no_sanitize' attribute directive ignored
  2024-03-10 22:30 [kees:for-next/hardening 28/42] include/linux/refcount.h:141:1: warning: 'no_sanitize' attribute directive ignored kernel test robot
@ 2024-03-13  3:48 ` Kees Cook
  0 siblings, 0 replies; 2+ messages in thread
From: Kees Cook @ 2024-03-13  3:48 UTC (permalink / raw)
  To: kernel test robot; +Cc: oe-kbuild-all, Miguel Ojeda

On Mon, Mar 11, 2024 at 06:30:13AM +0800, kernel test robot wrote:
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git for-next/hardening
> head:   6c069c8d3cfc30c5a399166b6ce63aa42a7d1dac
> commit: e697572c09d21678e2e8cc1256af165106fccb7f [28/42] refcount: Annotated intentional signed integer wrap-around
> config: um-randconfig-r053-20240310 (https://download.01.org/0day-ci/archive/20240311/202403110643.27JXEVCI-lkp@intel.com/config)
> compiler: gcc-7 (Ubuntu 7.5.0-6ubuntu2) 7.5.0
> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240311/202403110643.27JXEVCI-lkp@intel.com/reproduce)
> 
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <lkp@intel.com>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202403110643.27JXEVCI-lkp@intel.com/
> 
> All warnings (new ones prefixed by >>):
> 
>    In file included from include/linux/crypto.h:16:0,
>                     from arch/x86/um/shared/sysdep/kernel-offsets.h:5,
>                     from arch/um/kernel/asm-offsets.c:1:
> >> include/linux/refcount.h:141:1: warning: 'no_sanitize' attribute directive ignored [-Wattributes]

Oh, hm, it seems GCC 8 is needed for the "no_sanitize" attribute. I will
send a patch...

-- 
Kees Cook

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

end of thread, other threads:[~2024-03-13  3:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-10 22:30 [kees:for-next/hardening 28/42] include/linux/refcount.h:141:1: warning: 'no_sanitize' attribute directive ignored kernel test robot
2024-03-13  3:48 ` Kees Cook

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.