[linux-next:master 5435/5912] kernel/bpf/helpers.c:2491:41: warning: cast to pointer from integer of different size

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   7fc7222d9680366edeecc219c21ca96310bdbc10
commit: ec5290a178b787b2f8b21581fdadc919bd004e12 [5435/5912] bpf: Prevent KASAN false positive with bpf_throw
config: arc-randconfig-002-20230919 (https://download.01.org/0day-ci/archive/20230919/202309190741.A98l02ua-lkp@xxxxxxxxx/config)
compiler: arc-elf-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20230919/202309190741.A98l02ua-lkp@xxxxxxxxx/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@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202309190741.A98l02ua-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

   kernel/bpf/helpers.c: In function 'bpf_throw':
>> kernel/bpf/helpers.c:2491:41: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
    2491 |         kasan_unpoison_task_stack_below((void *)ctx.sp);
         |                                         ^


vim +2491 kernel/bpf/helpers.c

  2476	
  2477	__bpf_kfunc void bpf_throw(u64 cookie)
  2478	{
  2479		struct bpf_throw_ctx ctx = {};
  2480	
  2481		arch_bpf_stack_walk(bpf_stack_walker, &ctx);
  2482		WARN_ON_ONCE(!ctx.aux);
  2483		if (ctx.aux)
  2484			WARN_ON_ONCE(!ctx.aux->exception_boundary);
  2485		WARN_ON_ONCE(!ctx.bp);
  2486		WARN_ON_ONCE(!ctx.cnt);
  2487		/* Prevent KASAN false positives for CONFIG_KASAN_STACK by unpoisoning
  2488		 * deeper stack depths than ctx.sp as we do not return from bpf_throw,
  2489		 * which skips compiler generated instrumentation to do the same.
  2490		 */
> 2491		kasan_unpoison_task_stack_below((void *)ctx.sp);
  2492		ctx.aux->bpf_exception_cb(cookie, ctx.sp, ctx.bp);
  2493	}
  2494	

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




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux