[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAADnVQLKgP=Ejxm+C0d3tNeQVboEtAcB_QS=hdcCpw_8j-pXMg@mail.gmail.com>
Date: Fri, 23 May 2025 07:52:30 -0700
From: Alexei Starovoitov <alexei.starovoitov@...il.com>
To: KaFai Wan <mannkafai@...il.com>, Kuniyuki Iwashima <kuniyu@...zon.com>
Cc: syzbot <syzbot+0903f6d7f285e41cdf10@...kaller.appspotmail.com>,
Andrii Nakryiko <andrii@...nel.org>, Alexei Starovoitov <ast@...nel.org>, bpf <bpf@...r.kernel.org>,
Daniel Borkmann <daniel@...earbox.net>, Eduard <eddyz87@...il.com>, Hao Luo <haoluo@...gle.com>,
John Fastabend <john.fastabend@...il.com>, Jiri Olsa <jolsa@...nel.org>,
KP Singh <kpsingh@...nel.org>, LKML <linux-kernel@...r.kernel.org>,
Martin KaFai Lau <martin.lau@...ux.dev>, Stanislav Fomichev <sdf@...ichev.me>, Song Liu <song@...nel.org>,
syzkaller-bugs <syzkaller-bugs@...glegroups.com>, Yonghong Song <yonghong.song@...ux.dev>
Subject: Re: [syzbot] [bpf?] WARNING in __bpf_prog_ret0_warn
On Fri, May 23, 2025 at 7:48 AM KaFai Wan <mannkafai@...il.com> wrote:
>
> On Sat, 2025-05-03 at 20:47 -0700, syzbot wrote:
> > Hello,
> >
> > syzbot found the following issue on:
> >
> > HEAD commit: 8bac8898fe39 Merge tag 'mmc-v6.15-rc1' of
> > git://git.kernel..
> > git tree: upstream
> > console output:
> > https://syzkaller.appspot.com/x/log.txt?x=10f03774580000
> > kernel config:
> > https://syzkaller.appspot.com/x/.config?x=541aa584278da96c
> > dashboard link:
> > https://syzkaller.appspot.com/bug?extid=0903f6d7f285e41cdf10
> > compiler: gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils
> > for Debian) 2.40
> > syz repro:
> > https://syzkaller.appspot.com/x/repro.syz?x=1550ca70580000
> > C reproducer:
> > https://syzkaller.appspot.com/x/repro.c?x=17d10f74580000
> >
> > Downloadable assets:
> > disk image (non-bootable):
> > https://storage.googleapis.com/syzbot-assets/7feb34a89c2a/non_bootable_disk-8bac8898.raw.xz
> > vmlinux:
> > https://storage.googleapis.com/syzbot-assets/5f7c2d7e1cd1/vmlinux-8bac8898.xz
> > kernel image:
> > https://storage.googleapis.com/syzbot-assets/77a157d2769a/bzImage-8bac8898.xz
> >
> > IMPORTANT: if you fix the issue, please add the following tag to the
> > commit:
> > Reported-by: syzbot+0903f6d7f285e41cdf10@...kaller.appspotmail.com
> >
> > ------------[ cut here ]------------
> > WARNING: CPU: 3 PID: 217 at kernel/bpf/core.c:2357
> > __bpf_prog_ret0_warn+0xa/0x20 kernel/bpf/core.c:2357
> > Modules linked in:
> > CPU: 3 UID: 0 PID: 217 Comm: kworker/u32:6 Not tainted 6.15.0-rc4-
> > syzkaller-00040-g8bac8898fe39 #0 PREEMPT(full)
> > Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-
> > debian-1.16.3-2~bpo12+1 04/01/2014
> > Workqueue: ipv6_addrconf addrconf_dad_work
> > RIP: 0010:__bpf_prog_ret0_warn+0xa/0x20 kernel/bpf/core.c:2357
> > Code: f3 0f 1e fa e8 a7 c7 f0 ff 31 c0 c3 cc cc cc cc 90 90 90 90 90
> > 90 90 90 90 90 90 90 90 90 90 90 f3 0f 1e fa e8 87 c7 f0 ff 90 <0f>
> > 0b 90 31 c0 c3 cc cc cc cc 66 66 2e 0f 1f 84 00 00 00 00 00 90
> > RSP: 0018:ffffc900031f6c18 EFLAGS: 00010293
> > RAX: 0000000000000000 RBX: ffffc9000006e000 RCX: 1ffff9200000dc06
> > RDX: ffff8880234ba440 RSI: ffffffff81ca6979 RDI: ffff888031e93040
> > RBP: ffffc900031f6cb8 R08: 0000000000000001 R09: 0000000000000000
> > R10: 0000000000000000 R11: 0000000000000000 R12: ffff88802b61e010
> > R13: ffff888031e93040 R14: 00000000000000a0 R15: ffff88802c3d4800
> > FS: 0000000000000000(0000) GS:ffff8880d6ce2000(0000)
> > knlGS:0000000000000000
> > CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> > CR2: 000055557b6d2ca8 CR3: 000000002473e000 CR4: 0000000000352ef0
> > DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
> > DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
> > Call Trace:
> > <TASK>
> > bpf_dispatcher_nop_func include/linux/bpf.h:1316 [inline]
> > __bpf_prog_run include/linux/filter.h:718 [inline]
> > bpf_prog_run include/linux/filter.h:725 [inline]
> > cls_bpf_classify+0x74a/0x1110 net/sched/cls_bpf.c:105
> > tc_classify include/net/tc_wrapper.h:197 [inline]
> > __tcf_classify net/sched/cls_api.c:1764 [inline]
> > tcf_classify+0x7ef/0x1380 net/sched/cls_api.c:1860
> > htb_classify net/sched/sch_htb.c:245 [inline]
> > htb_enqueue+0x2f6/0x12d0 net/sched/sch_htb.c:624
> > dev_qdisc_enqueue net/core/dev.c:3984 [inline]
> > __dev_xmit_skb net/core/dev.c:4080 [inline]
> > __dev_queue_xmit+0x2142/0x43e0 net/core/dev.c:4595
> > dev_queue_xmit include/linux/netdevice.h:3350 [inline]
> > neigh_hh_output include/net/neighbour.h:523 [inline]
> > neigh_output include/net/neighbour.h:537 [inline]
> > ip_finish_output2+0xc38/0x21a0 net/ipv4/ip_output.c:235
> > __ip_finish_output net/ipv4/ip_output.c:313 [inline]
> > __ip_finish_output+0x49e/0x950 net/ipv4/ip_output.c:295
> > ip_finish_output+0x35/0x380 net/ipv4/ip_output.c:323
> > NF_HOOK_COND include/linux/netfilter.h:303 [inline]
> > ip_output+0x13b/0x2a0 net/ipv4/ip_output.c:433
> > dst_output include/net/dst.h:459 [inline]
> > ip_local_out+0x33e/0x4a0 net/ipv4/ip_output.c:129
> > iptunnel_xmit+0x5d5/0xa00 net/ipv4/ip_tunnel_core.c:82
> > geneve_xmit_skb drivers/net/geneve.c:921 [inline]
> > geneve_xmit+0x2bc5/0x5610 drivers/net/geneve.c:1046
> > __netdev_start_xmit include/linux/netdevice.h:5203 [inline]
> > netdev_start_xmit include/linux/netdevice.h:5212 [inline]
> > xmit_one net/core/dev.c:3776 [inline]
> > dev_hard_start_xmit+0x93/0x740 net/core/dev.c:3792
> > __dev_queue_xmit+0x7eb/0x43e0 net/core/dev.c:4629
> > dev_queue_xmit include/linux/netdevice.h:3350 [inline]
> > neigh_hh_output include/net/neighbour.h:523 [inline]
> > neigh_output include/net/neighbour.h:537 [inline]
> > ip6_finish_output2+0xe98/0x2020 net/ipv6/ip6_output.c:141
> > __ip6_finish_output net/ipv6/ip6_output.c:215 [inline]
> > ip6_finish_output+0x3f9/0x1360 net/ipv6/ip6_output.c:226
> > NF_HOOK_COND include/linux/netfilter.h:303 [inline]
> > ip6_output+0x1f9/0x540 net/ipv6/ip6_output.c:247
> > dst_output include/net/dst.h:459 [inline]
> > NF_HOOK include/linux/netfilter.h:314 [inline]
> > NF_HOOK include/linux/netfilter.h:308 [inline]
> > mld_sendpack+0x9e9/0x1220 net/ipv6/mcast.c:1868
> > mld_send_initial_cr.part.0+0x1a1/0x260 net/ipv6/mcast.c:2285
> > mld_send_initial_cr include/linux/refcount.h:291 [inline]
> > ipv6_mc_dad_complete+0x22c/0x2b0 net/ipv6/mcast.c:2293
> > addrconf_dad_completed+0xd8a/0x10d0 net/ipv6/addrconf.c:4341
> > addrconf_dad_work+0x84d/0x14e0 net/ipv6/addrconf.c:4269
> > process_one_work+0x9cc/0x1b70 kernel/workqueue.c:3238
> > process_scheduled_works kernel/workqueue.c:3319 [inline]
> > worker_thread+0x6c8/0xf10 kernel/workqueue.c:3400
> > kthread+0x3c2/0x780 kernel/kthread.c:464
> > ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:153
> > ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245
> > </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 syzkaller@...glegroups.com.
> >
> > syzbot will keep track of this issue. See:
> > https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
> >
> > If the report is already addressed, let syzbot know by replying with:
> > #syz fix: exact-commit-title
> >
> > If you want syzbot to run the reproducer, reply with:
> > #syz test: git://repo/address.git branch-or-commit-hash
> > If you attach or paste a git patch, syzbot will apply it before
> > testing.
> >
> > If you want to overwrite report's subsystems, reply with:
> > #syz set subsystems: new-subsystem
> > (See the list of subsystem names on the web dashboard)
> >
> > If the report is a duplicate of another one, reply with:
> > #syz dup: exact-subject-of-another-report
> >
> > If you want to undo deduplication, reply with:
> > #syz undup
> >
>
> I think this issue is triggered because of CONFIG_BPF_JIT_ALWAYS_ON is
> not set and /proc/sys/net/core/bpf_jit_enable is set to 1, causing the
> arch to attempt JIT the prog, but jit failed due to FAULT_INJECTION.
>
> When `bpf_jit_enable` set to 1, sets `fp->jit_requested = 1` to
> indicate need to jit when create BPF program. During runtime selection,
> set 'fp->bpf_func' to `__bpf_prog_ret0_warn` by default, and should
> return an error when prog need to jit(`jit_needed`) but not jited.
>
> Since CONFIG_BPF_JIT_ALWAYS_ON is not set and the BPF program contains
> no kfuncs, the `jit_needed` set to false. As a result, incorrectly
> treats the program as valid, when the program runs it calls
> `__bpf_prog_ret0_warn` and triggers the WARN_ON_ONCE(1).
>
> --
> Thanks,
> kafai
>
> #syz test
>
>
> diff --git a/kernel/bpf/core.c b/kernel/bpf/core.c
> index ba6b6118cf50..4c951d60bef5 100644
> --- a/kernel/bpf/core.c
> +++ b/kernel/bpf/core.c
> @@ -2474,8 +2474,7 @@ struct bpf_prog *bpf_prog_select_runtime(struct
> bpf_prog *fp, int *err)
> if (fp->bpf_func)
> goto finalize;
>
> - if (IS_ENABLED(CONFIG_BPF_JIT_ALWAYS_ON) ||
> - bpf_prog_has_kfunc_call(fp))
> + if (fp->jit_requested || bpf_prog_has_kfunc_call(fp))
> jit_needed = true;
Not quite.
See the thread:
https://lore.kernel.org/bpf/CAADnVQJ6NKjhWbr=ya4=R7HaWyyiFneLLisByW3JopfQQYLrpg@mail.gmail.com/
I'm still waiting for somebody to send the patch.
Powered by blists - more mailing lists