Subject: Re: [PATCH bpf-next v4 3/3] bpf: treewide: Annotate BPF kfuncs in BTF

From: kernel test robot <[email-masked]>
Date: Mon, 5 Feb 2024 10:41:30 +0800

Hello,

kernel test robot noticed "WARNING:at_kernel/bpf/btf.c:#register_btf_kfunc_id_set" on:

commit: 918c4c7dda155568c619b4082fa83ca90ab578a6 ("[PATCH bpf-next v4 3/3] bpf: treewide: Annotate BPF kfuncs in BTF")
url: https://github.com/intel-lab-lkp/linux/commits/Daniel-Xu/bpf-btf-Support-flags-for-BTF_SET8-sets/20240129-092732
base: https://git.kernel.org/cgit/linux/kernel/git/bpf/bpf-next.git master
patch link: https://lore.kernel.org/all/[email-masked]/
patch subject: [PATCH bpf-next v4 3/3] bpf: treewide: Annotate BPF kfuncs in BTF

in testcase: boot

compiler: clang-17
test machine: qemu-system-x86_64 -enable-kvm -cpu SandyBridge -smp 2 -m 16G

(please refer to attached dmesg/kmsg for entire log/backtrace)

+-----------------------------------------------------------------+------------+------------+
|                                                                 | 05221438c4 | 918c4c7dda |
+-----------------------------------------------------------------+------------+------------+
| WARNING:at_kernel/bpf/btf.c:#register_btf_kfunc_id_set          | 0          | 7          |
| EIP:register_btf_kfunc_id_set                                   | 0          | 7          |
| calltrace:do_softirq_own_stack                                  | 0          | 7          |
+-----------------------------------------------------------------+------------+------------+

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-masked]>
| Closes: https://lore.kernel.org/oe-lkp/[email-masked]

[   49.044594][    T1] ------------[ cut here ]------------
[ 49.045857][ T1] WARNING: CPU: 1 PID: 1 at kernel/bpf/btf.c:8048 register_btf_kfunc_id_set (??:?) 
[   49.048024][    T1] Modules linked in:
[   49.048925][    T1] CPU: 1 PID: 1 Comm: swapper/0 Tainted: G        W          6.8.0-rc1-00457-g918c4c7dda15 #6
[   49.051230][    T1] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.2-debian-1.16.2-1 04/01/2014
[ 49.053616][ T1] EIP: register_btf_kfunc_id_set (??:?) 
[ 49.054969][ T1] Code: 04 01 75 0b b8 ea ff ff ff 83 3a 00 74 1c c3 b9 0d 00 00 00 83 f8 20 77 07 8b 0c 85 28 a2 71 d7 55 89 e5 e8 13 00 00 00 5d c3 <0f> 0b c3 90 90 90 90 90 90 90 90 90 90 90 90 90 90 55 89 e5 53 57
All code
========
   0:	04 01                	add    $0x1,%al
   2:	75 0b                	jne    0xf
   4:	b8 ea ff ff ff       	mov    $0xffffffea,%eax
   9:	83 3a 00             	cmpl   $0x0,(%rdx)
   c:	74 1c                	je     0x2a
   e:	c3                   	retq   
   f:	b9 0d 00 00 00       	mov    $0xd,%ecx
  14:	83 f8 20             	cmp    $0x20,%eax
  17:	77 07                	ja     0x20
  19:	8b 0c 85 28 a2 71 d7 	mov    -0x288e5dd8(,%rax,4),%ecx
  20:	55                   	push   %rbp
  21:	89 e5                	mov    %esp,%ebp
  23:	e8 13 00 00 00       	callq  0x3b
  28:	5d                   	pop    %rbp
  29:	c3                   	retq   
  2a:*	0f 0b                	ud2    		<-- trapping instruction
  2c:	c3                   	retq   
  2d:	90                   	nop
  2e:	90                   	nop
  2f:	90                   	nop
  30:	90                   	nop
  31:	90                   	nop
  32:	90                   	nop
  33:	90                   	nop
  34:	90                   	nop
  35:	90                   	nop
  36:	90                   	nop
  37:	90                   	nop
  38:	90                   	nop
  39:	90                   	nop
  3a:	90                   	nop
  3b:	55                   	push   %rbp
  3c:	89 e5                	mov    %esp,%ebp
  3e:	53                   	push   %rbx
  3f:	57                   	push   %rdi

Code starting with the faulting instruction
===========================================
   0:	0f 0b                	ud2    
   2:	c3                   	retq   
   3:	90                   	nop
   4:	90                   	nop
   5:	90                   	nop
   6:	90                   	nop
   7:	90                   	nop
   8:	90                   	nop
   9:	90                   	nop
   a:	90                   	nop
   b:	90                   	nop
   c:	90                   	nop
   d:	90                   	nop
   e:	90                   	nop
   f:	90                   	nop
  10:	90                   	nop
  11:	55                   	push   %rbp
  12:	89 e5                	mov    %esp,%ebp
  14:	53                   	push   %rbx
  15:	57                   	push   %rdi
[   49.059550][    T1] EAX: ffffffea EBX: 00000000 ECX: d9356fb0 EDX: d7c2b154
[   49.061229][    T1] ESI: 00000000 EDI: 0000019a EBP: c028dc48 ESP: c028dc38
[   49.062886][    T1] DS: 007b ES: 007b FS: 00d8 GS: 0000 SS: 0068 EFLAGS: 00010246
[   49.064685][    T1] CR0: 80050033 CR2: 00000000 CR3: 189ab000 CR4: 000406f0
[   49.066358][    T1] DR0: 00000000 DR1: 00000000 DR2: 00000000 DR3: 00000000
[   49.068020][    T1] DR6: fffe0ff0 DR7: 00000400
[   49.069132][    T1] Call Trace:
[ 49.069902][ T1] ? show_regs (??:?) 
[ 49.070890][ T1] ? register_btf_kfunc_id_set (??:?) 
[ 49.072187][ T1] ? __warn (??:?) 
[ 49.073151][ T1] ? register_btf_kfunc_id_set (??:?) 
[ 49.074480][ T1] ? register_btf_kfunc_id_set (??:?) 
[ 49.075751][ T1] ? report_bug (??:?) 
[ 49.076858][ T1] ? exc_overflow (??:?) 
[ 49.077925][ T1] ? handle_bug (traps.c:?) 
[ 49.078947][ T1] ? exc_invalid_op (??:?) 
[ 49.080030][ T1] ? handle_exception (init_task.c:?) 
[ 49.081174][ T1] ? get_seg_base_limit (insn-eval.c:?) 
[ 49.082393][ T1] ? mutex_lock_killable_nested (??:?) 
[ 49.083707][ T1] ? exc_overflow (??:?) 
[ 49.084782][ T1] ? register_btf_kfunc_id_set (??:?) 
[ 49.086126][ T1] ? mutex_lock_killable_nested (??:?) 
[ 49.087468][ T1] ? exc_overflow (??:?) 
[ 49.088520][ T1] ? register_btf_kfunc_id_set (??:?) 
[ 49.089864][ T1] ? cubictcp_register (tcp_cubic.c:?) 
[ 49.090991][ T1] do_one_initcall (??:?) 
[ 49.092136][ T1] ? pvclock_clocksource_read_nowd (??:?) 
[ 49.093607][ T1] ? __lock_acquire (lockdep.c:?) 
[ 49.094756][ T1] ? kvm_sched_clock_read (kvmclock.c:?) 
[ 49.095985][ T1] ? sched_clock_noinstr (??:?) 
[ 49.097144][ T1] ? local_clock_noinstr (??:?) 
[ 49.098393][ T1] ? __lock_acquire (lockdep.c:?) 
[ 49.099575][ T1] ? sched_clock_noinstr (??:?) 
[ 49.100746][ T1] ? local_clock_noinstr (??:?) 
[ 49.101997][ T1] ? pvclock_clocksource_read_nowd (??:?) 
[ 49.103439][ T1] ? kvm_sched_clock_read (kvmclock.c:?) 
[ 49.104673][ T1] ? pvclock_clocksource_read_nowd (??:?) 
[ 49.106095][ T1] ? kvm_sched_clock_read (kvmclock.c:?) 
[ 49.107310][ T1] ? sched_clock_noinstr (??:?) 
[ 49.109773][ T1] ? local_clock_noinstr (??:?) 
[ 49.111018][ T1] ? __this_cpu_preempt_check (??:?) 
[ 49.112289][ T1] ? irqtime_account_irq (??:?) 
[ 49.113534][ T1] ? irqtime_account_delta (build_policy.c:?) 
[ 49.114812][ T1] ? irqentry_exit (??:?) 
[ 49.115860][ T1] ? __this_cpu_preempt_check (??:?) 
[ 49.117126][ T1] ? lockdep_hardirqs_on (??:?) 
[ 49.118370][ T1] ? sysvec_reboot (??:?) 
[ 49.119450][ T1] ? trace_hardirqs_on (??:?) 
[ 49.120623][ T1] ? irqentry_exit (??:?) 
[ 49.121703][ T1] ? sysvec_reschedule_ipi (??:?) 
[ 49.122962][ T1] ? handle_exception (init_task.c:?) 
[ 49.124130][ T1] ? strlen (??:?) 
[ 49.125054][ T1] ? next_arg (??:?) 
[ 49.126086][ T1] ? parse_args (??:?) 
[ 49.127134][ T1] ? tcp_diag_init (tcp_cubic.c:?) 
[ 49.128257][ T1] do_initcall_level (main.c:?) 
[ 49.129398][ T1] ? kernel_init (main.c:?) 
[ 49.130474][ T1] do_initcalls (main.c:?) 
[ 49.131494][ T1] do_basic_setup (main.c:?) 
[ 49.132558][ T1] kernel_init_freeable (main.c:?) 
[ 49.133781][ T1] ? rest_init (main.c:?) 
[ 49.134848][ T1] ? rest_init (main.c:?) 
[ 49.135885][ T1] kernel_init (main.c:?) 
[ 49.136958][ T1] ret_from_fork (??:?) 
[ 49.137979][ T1] ret_from_fork_asm (??:?) 
[ 49.139078][ T1] entry_INT80_32 (init_task.c:?) 
[   49.140171][    T1] irq event stamp: 16737757
[ 49.141202][ T1] hardirqs last enabled at (16737765): console_unlock (??:?) 
[ 49.143298][ T1] hardirqs last disabled at (16737774): console_unlock (??:?) 
[ 49.145355][ T1] softirqs last enabled at (16737610): do_softirq_own_stack (??:?) 
[ 49.147553][ T1] softirqs last disabled at (16737605): do_softirq_own_stack (??:?) 
[   49.149757][    T1] ---[ end trace 0000000000000000 ]---
[   49.151671][    T1] NET: Registered PF_INET6 protocol family
[   49.156896][    T1] Segment Routing with IPv6
[   49.158068][    T1] In-situ OAM (IOAM) with IPv6
[   49.159300][    T1] sit: IPv6, IPv4 and MPLS over IPv4 tunneling driver
[   49.162798][    T1] NET: Registered PF_PACKET protocol family
[   49.164686][    T1] 9pnet: Installing 9P2000 support
[   49.166257][    T1] start plist test
[   49.168281][    T1] end plist test
[   49.173855][    T1] IPI shorthand broadcast: enabled
[   49.175165][    C0] ... APIC ID:      00000000 (0)
[   49.176383][    C0] ... APIC VERSION: 00050014
[   49.177486][    C0] 0000000000000000000000000000000000000000000000000000000000000000
[   49.177486][    C0] 0000000000000000000000000000000000000000000000000000000008001000

The kernel config and materials to reproduce are available at:
https://download.01.org/0day-ci/archive/20240204/[email-masked]

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