Re: [PATCH bpf-next v3 1/2] bpf: implement bpf_send_signal_task() kfunc
From: kernel test robot
Date: Mon Oct 07 2024 - 21:42:42 EST
Hi Puranjay,
kernel test robot noticed the following build warnings:
[auto build test WARNING on bpf-next/master]
url: https://github.com/intel-lab-lkp/linux/commits/Puranjay-Mohan/bpf-implement-bpf_send_signal_task-kfunc/20241007-183648
base: https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master
patch link: https://lore.kernel.org/r/20241007103426.128923-2-puranjay%40kernel.org
patch subject: [PATCH bpf-next v3 1/2] bpf: implement bpf_send_signal_task() kfunc
config: i386-randconfig-141-20241008 (https://download.01.org/0day-ci/archive/20241008/202410080907.DFxFxfor-lkp@xxxxxxxxx/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241008/202410080907.DFxFxfor-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/202410080907.DFxFxfor-lkp@xxxxxxxxx/
All warnings (new ones prefixed by >>):
kernel/trace/bpf_trace.c: In function 'bpf_send_signal_common':
>> kernel/trace/bpf_trace.c:839:43: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
839 | info.si_value.sival_ptr = (void *)value;
| ^
vim +839 kernel/trace/bpf_trace.c
822
823 static int bpf_send_signal_common(u32 sig, enum pid_type type, struct task_struct *tsk, u64 value)
824 {
825 struct send_signal_irq_work *work = NULL;
826 kernel_siginfo_t info;
827 bool has_siginfo = false;
828
829 if (!tsk) {
830 tsk = current;
831 } else {
832 has_siginfo = true;
833 clear_siginfo(&info);
834 info.si_signo = sig;
835 info.si_errno = 0;
836 info.si_code = SI_KERNEL;
837 info.si_pid = 0;
838 info.si_uid = 0;
> 839 info.si_value.sival_ptr = (void *)value;
840 }
841
842 /* Similar to bpf_probe_write_user, task needs to be
843 * in a sound condition and kernel memory access be
844 * permitted in order to send signal to the current
845 * task.
846 */
847 if (unlikely(tsk->flags & (PF_KTHREAD | PF_EXITING)))
848 return -EPERM;
849 if (unlikely(!nmi_uaccess_okay()))
850 return -EPERM;
851 /* Task should not be pid=1 to avoid kernel panic. */
852 if (unlikely(is_global_init(tsk)))
853 return -EPERM;
854
855 if (irqs_disabled()) {
856 /* Do an early check on signal validity. Otherwise,
857 * the error is lost in deferred irq_work.
858 */
859 if (unlikely(!valid_signal(sig)))
860 return -EINVAL;
861
862 work = this_cpu_ptr(&send_signal_work);
863 if (irq_work_is_busy(&work->irq_work))
864 return -EBUSY;
865
866 /* Add the current task, which is the target of sending signal,
867 * to the irq_work. The current task may change when queued
868 * irq works get executed.
869 */
870 work->task = get_task_struct(tsk);
871 work->has_siginfo = has_siginfo;
872 work->info = info;
873 work->sig = sig;
874 work->type = type;
875 irq_work_queue(&work->irq_work);
876 return 0;
877 }
878
879 if (has_siginfo)
880 return group_send_sig_info(sig, &info, tsk, type);
881
882 return group_send_sig_info(sig, SEND_SIG_PRIV, tsk, type);
883 }
884
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki