include/linux/refcount.h:141:1: warning: 'no_sanitize' attribute directive ignored
kernel test robot
build bottree: 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/[email protected]/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/[email protected]/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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
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 <[email protected]>
:::::: CC: Ingo Molnar <[email protected]>
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
Quoted 12 lines · kernel test robot
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/[email protected]/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/[email protected]/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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
Quoted 6 lines
All warnings (new ones prefixed by >>):
In file included from
include/linux/crypto.h:16:0,
fromarch/x86/um/shared/sysdep/kernel-offsets.h:5, fromarch/um/kernel/asm-offsets.c:1:Quoted 1 line
Quoted 1 line
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...
Signature · 1 line
Kees Cook