Skip to contentSkip to conversation

include/linux/kasan.h:199:43: error: use of undeclared identifier '_RET_IP_'

PATCH kernel test robot 1 participant 1 message Jun 30

lore
Share & tools
lore

kernel test robot

author build bot
#0 lore raw
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   7de6ae9e12207ec146f2f3f1e58d1a99317e88bc
commit: 9cbc3d9806d31abda2718ceac587ddee3a04849b [885/1356] tracing: Remove trace_printk.h from kernel.h
config: arm64-randconfig-r123-20260630 (https://download.01.org/0day-ci/archive/20260630/[email protected]/config)
compiler: clang version 23.0.0git (https://github.com/llvm/llvm-project 6cc609bb250b21b47fc7d394b4019101e9983597)
sparse: v0.6.5-rc1
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260630/[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 errors (new ones prefixed by >>):

In file included from kernel/scs.c:9:

>> include/linux/kasan.h:199:43: error: use of undeclared identifier '_RET_IP_'
     199 |                 return __kasan_slab_pre_free(s, object, _RET_IP_);
         |                                                         ^~~~~~~~
   include/linux/kasan.h:244:28: error: use of undeclared identifier '_RET_IP_'
     244 |                 __kasan_kfree_large(ptr, _RET_IP_);
         |                                          ^~~~~~~~
   include/linux/kasan.h:309:52: error: use of undeclared identifier '_RET_IP_'
     309 |                 return __kasan_mempool_poison_pages(page, order, _RET_IP_);
         |                                                                  ^~~~~~~~
   include/linux/kasan.h:331:47: error: use of undeclared identifier '_RET_IP_'
     331 |                 __kasan_mempool_unpoison_pages(page, order, _RET_IP_);
         |                                                             ^~~~~~~~
   include/linux/kasan.h:363:45: error: use of undeclared identifier '_RET_IP_'
     363 |                 return __kasan_mempool_poison_object(ptr, _RET_IP_);
         |                                                           ^~~~~~~~
   include/linux/kasan.h:391:46: error: use of undeclared identifier '_RET_IP_'
     391 |                 __kasan_mempool_unpoison_object(ptr, size, _RET_IP_);
         |                                                            ^~~~~~~~
   include/linux/kasan.h:402:35: error: use of undeclared identifier '_RET_IP_'
     402 |                 return __kasan_check_byte(addr, _RET_IP_);
         |                                                 ^~~~~~~~
   In file included from kernel/scs.c:10:
   In file included from include/linux/mm.h:36:
   In file included from include/linux/rcuwait.h:6:
   In file included from include/linux/sched/signal.h:6:
   include/linux/signal.h:98:11: warning: array index 3 is past the end of the array (that has type 'unsigned long[1]') [-Warray-bounds]
      98 |                 return (set->sig[3] | set->sig[2] |
         |                         ^        ~
   include/uapi/asm-generic/signal.h:62:2: note: array 'sig' declared here
      62 |         unsigned long sig[_NSIG_WORDS];
         |         ^
   In file included from kernel/scs.c:10:
   In file included from include/linux/mm.h:36:
   In file included from include/linux/rcuwait.h:6:
   In file included from include/linux/sched/signal.h:6:
   include/linux/signal.h:98:25: warning: array index 2 is past the end of the array (that has type 'unsigned long[1]') [-Warray-bounds]
      98 |                 return (set->sig[3] | set->sig[2] |
         |                                       ^        ~
   include/uapi/asm-generic/signal.h:62:2: note: array 'sig' declared here
      62 |         unsigned long sig[_NSIG_WORDS];
         |         ^
   In file included from kernel/scs.c:10:
   In file included from include/linux/mm.h:36:
   In file included from include/linux/rcuwait.h:6:
   In file included from include/linux/sched/signal.h:6:
   include/linux/signal.h:99:4: warning: array index 1 is past the end of the array (that has type 'unsigned long[1]') [-Warray-bounds]
      99 |                         set->sig[1] | set->sig[0]) == 0;
         |                         ^        ~
   include/uapi/asm-generic/signal.h:62:2: note: array 'sig' declared here
      62 |         unsigned long sig[_NSIG_WORDS];
         |         ^
   In file included from kernel/scs.c:10:
   In file included from include/linux/mm.h:36:
   In file included from include/linux/rcuwait.h:6:
   In file included from include/linux/sched/signal.h:6:
   include/linux/signal.h:101:11: warning: array index 1 is past the end of the array (that has type 'unsigned long[1]') [-Warray-bounds]
     101 |                 return (set->sig[1] | set->sig[0]) == 0;
         |                         ^        ~
   include/uapi/asm-generic/signal.h:62:2: note: array 'sig' declared here
      62 |         unsigned long sig[_NSIG_WORDS];
         |         ^
   In file included from kernel/scs.c:10:
   In file included from include/linux/mm.h:36:
   In file included from include/linux/rcuwait.h:6:
   In file included from include/linux/sched/signal.h:6:
   include/linux/signal.h:114:11: warning: array index 3 is past the end of the array (that has type 'const unsigned long[1]') [-Warray-bounds]
     114 |                 return  (set1->sig[3] == set2->sig[3]) &&
         |                          ^         ~
   include/uapi/asm-generic/signal.h:62:2: note: array 'sig' declared here
      62 |         unsigned long sig[_NSIG_WORDS];
         |         ^
   In file included from kernel/scs.c:10:
   In file included from include/linux/mm.h:36:
   In file included from include/linux/rcuwait.h:6:
   In file included from include/linux/sched/signal.h:6:
   include/linux/signal.h:114:27: warning: array index 3 is past the end of the array (that has type 'const unsigned long[1]') [-Warray-bounds]
     114 |                 return  (set1->sig[3] == set2->sig[3]) &&
         |                                          ^         ~
   include/uapi/asm-generic/signal.h:62:2: note: array 'sig' declared here
      62 |         unsigned long sig[_NSIG_WORDS];
         |         ^
   In file included from kernel/scs.c:10:
   In file included from include/linux/mm.h:36:
   In file included from include/linux/rcuwait.h:6:
   In file included from include/linux/sched/signal.h:6:
   include/linux/signal.h:115:5: warning: array index 2 is past the end of the array (that has type 'const unsigned long[1]') [-Warray-bounds]
     115 |                         (set1->sig[2] == set2->sig[2]) &&
         |                          ^         ~
   include/uapi/asm-generic/signal.h:62:2: note: array 'sig' declared here
      62 |         unsigned long sig[_NSIG_WORDS];
         |         ^
   In file included from kernel/scs.c:10:
   In file included from include/linux/mm.h:36:
   In file included from include/linux/rcuwait.h:6:
   In file included from include/linux/sched/signal.h:6:
   include/linux/signal.h:115:21: warning: array index 2 is past the end of the array (that has type 'const unsigned long[1]') [-Warray-bounds]
     115 |                         (set1->sig[2] == set2->sig[2]) &&
         |                                          ^         ~
   include/uapi/asm-generic/signal.h:62:2: note: array 'sig' declared here
      62 |         unsigned long sig[_NSIG_WORDS];
         |         ^

vim +/_RET_IP_ +199 include/linux/kasan.h

34303244f2615ad Andrey Konovalov 2020-12-22  181  
b3c34245756adad Jann Horn        2024-08-09  182  bool __kasan_slab_pre_free(struct kmem_cache *s, void *object,
b3c34245756adad Jann Horn        2024-08-09  183  			unsigned long ip);
b3c34245756adad Jann Horn        2024-08-09  184  /**
b3c34245756adad Jann Horn        2024-08-09  185   * kasan_slab_pre_free - Check whether freeing a slab object is safe.
b3c34245756adad Jann Horn        2024-08-09  186   * @object: Object to be freed.
b3c34245756adad Jann Horn        2024-08-09  187   *
b3c34245756adad Jann Horn        2024-08-09  188   * This function checks whether freeing the given object is safe. It may
b3c34245756adad Jann Horn        2024-08-09  189   * check for double-free and invalid-free bugs and report them.
b3c34245756adad Jann Horn        2024-08-09  190   *
b3c34245756adad Jann Horn        2024-08-09  191   * This function is intended only for use by the slab allocator.
b3c34245756adad Jann Horn        2024-08-09  192   *
b3c34245756adad Jann Horn        2024-08-09  193   * @Return true if freeing the object is unsafe; false otherwise.
b3c34245756adad Jann Horn        2024-08-09  194   */
b3c34245756adad Jann Horn        2024-08-09  195  static __always_inline bool kasan_slab_pre_free(struct kmem_cache *s,
b3c34245756adad Jann Horn        2024-08-09  196  						void *object)
b3c34245756adad Jann Horn        2024-08-09  197  {
b3c34245756adad Jann Horn        2024-08-09  198  	if (kasan_enabled())
b3c34245756adad Jann Horn        2024-08-09 @199  		return __kasan_slab_pre_free(s, object, _RET_IP_);
b3c34245756adad Jann Horn        2024-08-09  200  	return false;
b3c34245756adad Jann Horn        2024-08-09  201  }
b3c34245756adad Jann Horn        2024-08-09  202  

:::::: The code at line 199 was first introduced by commit
:::::: b3c34245756adada8a50bdaedbb3965b071c7b0a kasan: catch invalid free before SLUB reinitializes the object

:::::: TO: Jann Horn <[email protected]>
:::::: CC: Vlastimil Babka <[email protected]>

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