Subject: [syzbot] bpf-next boot error: WARNING in bpf_prog_pack_free

From: syzbot <[email-masked]>
Date: Sun, 20 Mar 2022 23:55:22 -0700

Hello,

syzbot found the following issue on:

HEAD commit:    7ada3787e91c bpf: Check for NULL return from bpf_get_btf_v..
git tree:       bpf-next
console output: https://syzkaller.appspot.com/x/log.txt?x=14079871700000
kernel config:  https://syzkaller.appspot.com/x/.config?x=820db791969fe863
dashboard link: https://syzkaller.appspot.com/bug?extid=c946805b5ce6ab87df0b
compiler:       gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: [email-masked]

------------[ cut here ]------------
bpf_prog_pack bug
WARNING: CPU: 0 PID: 8 at kernel/bpf/core.c:947 bpf_prog_pack_free+0x2fc/0x3a0 kernel/bpf/core.c:947
Modules linked in:
CPU: 0 PID: 8 Comm: kworker/0:1 Not tainted 5.17.0-rc6-syzkaller-02056-g7ada3787e91c #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Workqueue: events bpf_prog_free_deferred
RIP: 0010:bpf_prog_pack_free+0x2fc/0x3a0 kernel/bpf/core.c:947
Code: 0b 31 ff 89 de e8 64 44 f3 ff 84 db 0f 85 82 fe ff ff e8 d7 41 f3 ff 48 c7 c7 60 df b2 89 c6 05 e2 99 fa 0b 01 e8 6b 10 87 07 <0f> 0b e9 63 fe ff ff e8 b8 41 f3 ff 0f 0b 0f 0b 41 be ff ff ff ff
RSP: 0000:ffffc900000d7c60 EFLAGS: 00010282
RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000000
RDX: ffff888010e65700 RSI: ffffffff815fe3a8 RDI: fffff5200001af7e
RBP: ffffffff8bc177e0 R08: 0000000000000000 R09: 0000000000000001
R10: ffffffff815f8a3e R11: 0000000000000000 R12: ffff8881449f4010
R13: ffffffffa0400000 R14: ffffffffa0600640 R15: 0000000000000540
FS:  0000000000000000(0000) GS:ffff8880b9c00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: ffff88823ffff000 CR3: 000000000b88e000 CR4: 00000000003506f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 <TASK>
 bpf_jit_binary_pack_free kernel/bpf/core.c:1151 [inline]
 bpf_jit_free+0x11d/0x2b0 kernel/bpf/core.c:1180
 bpf_prog_free_deferred+0x5c1/0x790 kernel/bpf/core.c:2553
 process_one_work+0x9ac/0x1650 kernel/workqueue.c:2307
 worker_thread+0x657/0x1110 kernel/workqueue.c:2454
 kthread+0x2e9/0x3a0 kernel/kthread.c:377
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295
 </TASK>

---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at [email-masked].

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.