Re: [PATCH bpf-next v12 2/6] bpf: Add bpf_prog_run_array_sleepable()

Mykyta Yatsenko
2026-04-22T18:27:09Z

Kumar Kartikeya Dwivedi <memxor@gmail.com> writes:

> On Wed, 22 Apr 2026 at 19:57, Kumar Kartikeya Dwivedi <memxor@gmail.com> wrote:
>>
>> On Wed, 22 Apr 2026 at 19:00, Alexei Starovoitov
>> <alexei.starovoitov@gmail.com> wrote:
>> >
>> > On Wed, Apr 22, 2026 at 9:36 AM Mykyta Yatsenko
>> > <mykyta.yatsenko5@gmail.com> wrote:
>> > >
>> > > >> +
>> > > >> + if (prog->sleepable) {
>> > > >> + guard(rcu)();
>> > > >> + ret &= run_prog(prog, ctx);
>> > > >> + } else {
>> > > >> + ret &= run_prog(prog, ctx);
>> > > >> + }
>> > > >
>> > >
>> > > Yep, this one should be inverted.
>> >
>> > Ohh and CI was green. Looks like there is a gap in test coverage.
>> > I thought you added a test that does something like bpf_copy_from_user.
>> > We should have seen the splat with config_debug_atomic_sleep.
>> > What happened?
>>
>> CI will likely be green even with splat, since it may not be
>> registered as test failure?
>
> I can see the warning here:
> https://github.com/kernel-patches/bpf/actions/runs/24787752184/job/72539372270#step:7:8176
> We likely need to add some post processing step on dmesg that errors
> out on new BUG/WARNING lines in dmesg.

I remember some discussions about adding check for splats.

One of the tests produced this:
2026-04-22T15:58:06.3608335Z [ 339.347712] BUG: sleeping function called from invalid context at include/linux/uaccess.h:169
2026-04-22T15:58:06.3610984Z [ 339.348335] in_atomic(): 0, irqs_disabled(): 0, non_block: 0, pid: 125, name: new_name
2026-04-22T15:58:06.3613195Z [ 339.348895] preempt_count: 0, expected: 0
2026-04-22T15:58:06.3616372Z [ 339.349178] RCU nest depth: 1, expected: 0
2026-04-22T15:58:06.3618726Z [ 339.349472] INFO: lockdep is turned off.
2026-04-22T15:58:06.3631799Z [ 339.349760] CPU: 3 UID: 0 PID: 125 Comm: new_name Tainted: G OE K 7.0.0-g633419d54537 #1 PREEMPT(full)
2026-04-22T15:58:06.3634411Z [ 339.349766] Tainted: [O]=OOT_MODULE, [E]=UNSIGNED_MODULE, [K]=LIVEPATCH
2026-04-22T15:58:06.3642066Z [ 339.349768] Hardware name: QEMU Ubuntu 24.04 PC v2 (i440FX + PIIX, arch_caps fix, 1996), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
2026-04-22T15:58:06.3643327Z [ 339.349771] Call Trace:
2026-04-22T15:58:06.3644813Z [ 339.349774] <TASK>
2026-04-22T15:58:06.3647734Z [ 339.349776] dump_stack_lvl+0x5d/0x80
2026-04-22T15:58:06.3650841Z [ 339.349788] __might_resched.cold+0x1a7/0x21f
2026-04-22T15:58:06.3653880Z [ 339.349793] ? __pfx___might_resched+0x10/0x10
2026-04-22T15:58:06.3657586Z [ 339.349797] ? __pfx___mutex_unlock_slowpath+0x10/0x10
2026-04-22T15:58:06.3661044Z [ 339.349805] ? perf_event_attach_bpf_prog+0x14b/0x3e0
2026-04-22T15:58:06.3663190Z [ 339.349811] __might_fault+0x66/0x140
2026-04-22T15:58:06.3666611Z [ 339.349818] ? __pfx___might_resched+0x10/0x10
2026-04-22T15:58:06.3669065Z [ 339.349821] _copy_from_user+0x26/0xa0
2026-04-22T15:58:06.3672032Z [ 339.349826] bpf_copy_from_user+0x29/0x60
2026-04-22T15:58:06.3676593Z [ 339.349834] bpf_prog_6d749d25945227f7_handle_sys_enter_tp+0x5d/0x88
2026-04-22T15:58:06.3679583Z [ 339.349837] trace_call_bpf_faultable+0x460/0xa60
2026-04-22T15:58:06.3682800Z [ 339.349841] ? perf_event_ctx_lock_nested+0x193/0x360
2026-04-22T15:58:06.3686442Z [ 339.349847] ? __pfx_trace_call_bpf_faultable+0x10/0x10
2026-04-22T15:58:06.3689643Z [ 339.349849] ? __pfx__perf_ioctl+0x10/0x10
2026-04-22T15:58:06.3692583Z [ 339.349856] perf_call_bpf_enter+0x167/0x2b0
2026-04-22T15:58:06.3695171Z [ 339.349862] ? lock_release+0x256/0x2f0
2026-04-22T15:58:06.3698222Z [ 339.349868] ? __pfx_perf_call_bpf_enter+0x10/0x10
2026-04-22T15:58:06.3701676Z [ 339.349874] ? perf_syscall_enter+0x2a9/0x7d0
2026-04-22T15:58:06.3704200Z [ 339.349877] ? __fget_files+0x1b4/0x2f0
2026-04-22T15:58:06.3706543Z [ 339.349883] ? put_ctx+0x20/0x180
2026-04-22T15:58:06.3709243Z [ 339.349885] ? lock_acquire+0x2b6/0x2f0
2026-04-22T15:58:06.3711654Z [ 339.349890] ? lock_release+0x256/0x2f0
2026-04-22T15:58:06.3714661Z [ 339.349894] ? __might_fault+0xc5/0x140
2026-04-22T15:58:06.3717508Z [ 339.349897] perf_syscall_enter+0x2a9/0x7d0
2026-04-22T15:58:06.3720433Z [ 339.349902] ? __pfx_perf_syscall_enter+0x10/0x10
2026-04-22T15:58:06.3723889Z [ 339.349907] ? __pfx___might_resched+0x10/0x10
2026-04-22T15:58:06.3726935Z [ 339.349909] ? __pfx_fput_close_sync+0x10/0x10
2026-04-22T15:58:06.3729429Z [ 339.349916] trace_syscall_enter+0xb5/0x110
2026-04-22T15:58:06.3732027Z [ 339.349921] do_syscall_64+0x524/0x5f0
2026-04-22T15:58:06.3735196Z [ 339.349927] ? __irq_exit_rcu+0x40/0x1e0
2026-04-22T15:58:06.3738744Z [ 339.349933] entry_SYSCALL_64_after_hwframe+0x76/0x7e
2026-04-22T15:58:06.3740690Z [ 339.349937] RIP: 0033:0x7f47209ae28d
2026-04-22T15:58:06.3755178Z [ 339.349940] Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 90 f3 0f 1e fa 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 5b bb 0d 00 f7 d8 64 89 01 48
2026-04-22T15:58:06.3758736Z [ 339.349944] RSP: 002b:00007ffd43505848 EFLAGS: 00000206 ORIG_RAX: 000000000000004f
2026-04-22T15:58:06.3763493Z [ 339.349949] RAX: ffffffffffffffda RBX: 00007f4720f75000 RCX: 00007f47209ae28d
2026-04-22T15:58:06.3768294Z [ 339.349951] RDX: 00007f472097ca9b RSI: 0000000000001000 RDI: 00007ffd43505860
2026-04-22T15:58:06.3773718Z [ 339.349954] RBP: 00007ffd435068c0 R08: 0000000000000000 R09: 0000000000000000
2026-04-22T15:58:06.3778607Z [ 339.349956] R10: 0000000000000064 R11: 0000000000000206 R12: 0000000000000008
2026-04-22T15:58:06.3783368Z [ 339.349958] R13: 0000000000000000 R14: 00005648b9bf8550 R15: 00007f4720fb8000
2026-04-22T15:58:06.3784686Z [ 339.349963] </TASK>