* [BUG] bpf: kprobe_multi allows BPF_F_SLEEPABLE programs, causing sleeping-in-atomic splat
@ 2026-04-01 13:44 Varun R Mallya
2026-04-01 13:49 ` [PATCH bpf] bpf: Reject sleepable kprobe_multi programs at attach time Varun R Mallya
2026-04-01 16:25 ` [PATCH bpf v2] " Varun R Mallya
0 siblings, 2 replies; 6+ messages in thread
From: Varun R Mallya @ 2026-04-01 13:44 UTC (permalink / raw)
To: bpf
Cc: linux-kernel, kpsingh, mattbobrowski, ast, daniel, andrii,
martin.lau, eddyz87, memxor, song, yonghong.song, jolsa, rostedt,
mhiramat, mathieu.desnoyers, linux-trace-kernel
Hi,
I found a bug in the kprobe_multi BPF link creation path where the kernel
fails to reject programs with BPF_F_SLEEPABLE set.
kprobe.multi programs run in an atomic/RCU context and cannot sleep.
However, bpf_link_create() with BPF_TRACE_KPROBE_MULTI does not validate
whether the program being attached has BPF_F_SLEEPABLE set. This allows
sleepable helpers such as bpf_copy_from_user() to be invoked from a
non-sleepable context, triggering a "sleeping function called from invalid
context" splat.
Reproducer:
/* crash.bpf.c */
SEC("kprobe.multi")
int handle_kprobe_multi_crash(struct pt_regs *ctx)
{
char buf[16];
int ret;
ret = bpf_copy_from_user(buf, sizeof(buf), (void *)ctx->sp);
bpf_printk("bpf_copy_from_user ret: %d\n", ret);
return 0;
}
/* loader: manually set BPF_F_SLEEPABLE before load, then attach via
bpf_link_create() with BPF_TRACE_KPROBE_MULTI */
bpf_program__set_flags(prog, BPF_F_SLEEPABLE);
Kernel output (bpf-next 7.0.0-rc5+):
[ 483.577248] BUG: sleeping function called from invalid context at ./include/linux/uaccess.h:
169
[ 483.577364] in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 1787, name: sudo
[ 483.577420] preempt_count: 1, expected: 0
[ 483.577453] RCU nest depth: 2, expected: 0
[ 483.577486] INFO: lockdep is turned off.
Attachment successful! The bug is confirmed.
Check 'sudo dmesg -w' for BPF prints and warnings.
Triggering v[ 483.577569] CfsPU: 7 UID: 0 PID: 1787 Comm: sudo Tainted: G W _
rea7.0.0-rc5+ #4 PREEMPT(full)
d[ 483.577571] T.ainted: [W]=WARN..
Su[ 483.577572] Hrvardware name: Bochs Bochs, BIOS iBochs 01/01/2011v
[ 483.577573] Call Trace:
[ 483.577575] e<TASK>
[ 483.577578] d!dump_stack_lvl+0x54/0x70
[ 483.577582] If __might_resched+b0x200/0x220
p[ 483.577585] f__might_fault+0x_c2c/0x80
o[ 483.577587] p_copy_from_user+y0x23/0x80
_[ 483.577591] bpf_copy_from_user+0x27/0x50
[ 483.577594] fbpf_prog_1906cf6roa66546b5e_handlem__kprobe_multi_crash+0x33/0x4d
u[ 483.577596] skprobe_multi_linek_handler+0x15d/r re0x260
[ 483.577599] t? kprobe_multi_lurink_handler+0x99n/0x260
[ 483.577602] e? __pfx_vfs_readd +0x10/0x10
0[ 483.577604] in? ksys_read+0x7c/0x100
[ 483.577605] dm? vfs_read+0x4/0esg, x360
t[ 483.577607] fprobe_ftrace_entry+0x3b8/0x480
[ 483.577609] h? ksys_read+0x7ce /0x100
e[ 483.577610] x? fprobe_ftrace_pentry+0x93/0x480l
o[ 483.577612] it? lock_release+0x42/0x330
[ 483.577615] ? vfs_read+0x9/0wx360
o[ 483.577616] r? __x64_sys_rt_sigaction+0xde/0xke120
[ 483.577619] ? vfs_read+0x9/0x360
[ 483.577620] d? ksys_read+0x7c./0x100
[ 483.577622]
? do_syscall_64+0x143/0xf80
[ 483.577624] ? entry_SYSCALL_64_after_hwframe+0x77/0x7f
[ 483.577625] ? trace_irq_disable+0x1d/0xc0
[ 483.577627] ? entry_SYSCALL_64_after_hwframe+0x77/0x7f
[ 483.577631] </TASK>
I am sending in a patch that fixes this.
Signed-off-by: Varun R Mallya <varunrmallya@gmail.com>
^ permalink raw reply [flat|nested] 6+ messages in thread* [PATCH bpf] bpf: Reject sleepable kprobe_multi programs at attach time 2026-04-01 13:44 [BUG] bpf: kprobe_multi allows BPF_F_SLEEPABLE programs, causing sleeping-in-atomic splat Varun R Mallya @ 2026-04-01 13:49 ` Varun R Mallya 2026-04-01 14:08 ` Kumar Kartikeya Dwivedi 2026-04-01 16:25 ` [PATCH bpf v2] " Varun R Mallya 1 sibling, 1 reply; 6+ messages in thread From: Varun R Mallya @ 2026-04-01 13:49 UTC (permalink / raw) To: varunrmallya Cc: andrii, ast, bpf, daniel, eddyz87, jolsa, kpsingh, linux-kernel, linux-trace-kernel, martin.lau, mathieu.desnoyers, mattbobrowski, memxor, mhiramat, rostedt, song, yonghong.song kprobe.multi programs run in atomic/RCU context and cannot sleep. However, bpf_kprobe_multi_link_attach() did not validate whether the program being attached had the sleepable flag set, allowing sleepable helpers such as bpf_copy_from_user() to be invoked from a non-sleepable context. This causes a "sleeping function called from invalid context" splat: BUG: sleeping function called from invalid context at ./include/linux/uaccess.h:169 in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 1787, name: sudo preempt_count: 1, expected: 0 RCU nest depth: 2, expected: 0 Fix this by rejecting sleepable programs early in bpf_kprobe_multi_link_attach(), before any further processing. Fixes: 0dcac272540613d41c05e89679e4ddb978b612f1 ("bpf: Add multi kprobe link") Signed-off-by: Varun R Mallya <varunrmallya@gmail.com> --- kernel/trace/bpf_trace.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c index 0b040a417442..af7079aa0f36 100644 --- a/kernel/trace/bpf_trace.c +++ b/kernel/trace/bpf_trace.c @@ -2752,6 +2752,10 @@ int bpf_kprobe_multi_link_attach(const union bpf_attr *attr, struct bpf_prog *pr if (!is_kprobe_multi(prog)) return -EINVAL; + /* kprobe_multi is not allowed to be sleepable. */ + if (prog->sleepable) + return -EINVAL; + /* Writing to context is not allowed for kprobes. */ if (prog->aux->kprobe_write_ctx) return -EINVAL; -- 2.53.0 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH bpf] bpf: Reject sleepable kprobe_multi programs at attach time 2026-04-01 13:49 ` [PATCH bpf] bpf: Reject sleepable kprobe_multi programs at attach time Varun R Mallya @ 2026-04-01 14:08 ` Kumar Kartikeya Dwivedi 2026-04-01 14:42 ` Kumar Kartikeya Dwivedi 0 siblings, 1 reply; 6+ messages in thread From: Kumar Kartikeya Dwivedi @ 2026-04-01 14:08 UTC (permalink / raw) To: Varun R Mallya, jolsa Cc: andrii, ast, bpf, daniel, eddyz87, kpsingh, linux-kernel, linux-trace-kernel, martin.lau, mathieu.desnoyers, mattbobrowski, mhiramat, rostedt, song, yonghong.song On Wed, 1 Apr 2026 at 15:49, Varun R Mallya <varunrmallya@gmail.com> wrote: > > kprobe.multi programs run in atomic/RCU context and cannot sleep. > However, bpf_kprobe_multi_link_attach() did not validate whether the > program being attached had the sleepable flag set, allowing sleepable > helpers such as bpf_copy_from_user() to be invoked from a non-sleepable > context. > > This causes a "sleeping function called from invalid context" splat: > > BUG: sleeping function called from invalid context at ./include/linux/uaccess.h:169 > in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 1787, name: sudo > preempt_count: 1, expected: 0 > RCU nest depth: 2, expected: 0 > > Fix this by rejecting sleepable programs early in > bpf_kprobe_multi_link_attach(), before any further processing. > > Fixes: 0dcac272540613d41c05e89679e4ddb978b612f1 ("bpf: Add multi kprobe link") Please use the right format. Fixes: 0dcac2725406 ("bpf: Add multi kprobe link") You can add the follow to your .gitconfig to generate the fixes tag. [alias] fixes = log -1 --format='Fixes: %h (\"%s\")' > Signed-off-by: Varun R Mallya <varunrmallya@gmail.com> > --- > kernel/trace/bpf_trace.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c > index 0b040a417442..af7079aa0f36 100644 > --- a/kernel/trace/bpf_trace.c > +++ b/kernel/trace/bpf_trace.c > @@ -2752,6 +2752,10 @@ int bpf_kprobe_multi_link_attach(const union bpf_attr *attr, struct bpf_prog *pr > if (!is_kprobe_multi(prog)) > return -EINVAL; > > + /* kprobe_multi is not allowed to be sleepable. */ > + if (prog->sleepable) > + return -EINVAL; > + Looks ok to me, Jiri, could you also take a look? > /* Writing to context is not allowed for kprobes. */ > if (prog->aux->kprobe_write_ctx) > return -EINVAL; > -- > 2.53.0 > ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH bpf] bpf: Reject sleepable kprobe_multi programs at attach time 2026-04-01 14:08 ` Kumar Kartikeya Dwivedi @ 2026-04-01 14:42 ` Kumar Kartikeya Dwivedi 0 siblings, 0 replies; 6+ messages in thread From: Kumar Kartikeya Dwivedi @ 2026-04-01 14:42 UTC (permalink / raw) To: Varun R Mallya, jolsa Cc: andrii, ast, bpf, daniel, eddyz87, kpsingh, linux-kernel, linux-trace-kernel, martin.lau, mathieu.desnoyers, mattbobrowski, mhiramat, rostedt, song, yonghong.song On Wed, 1 Apr 2026 at 16:08, Kumar Kartikeya Dwivedi <memxor@gmail.com> wrote: > > On Wed, 1 Apr 2026 at 15:49, Varun R Mallya <varunrmallya@gmail.com> wrote: > > > > kprobe.multi programs run in atomic/RCU context and cannot sleep. > > However, bpf_kprobe_multi_link_attach() did not validate whether the > > program being attached had the sleepable flag set, allowing sleepable > > helpers such as bpf_copy_from_user() to be invoked from a non-sleepable > > context. > > > > This causes a "sleeping function called from invalid context" splat: > > > > BUG: sleeping function called from invalid context at ./include/linux/uaccess.h:169 > > in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 1787, name: sudo > > preempt_count: 1, expected: 0 > > RCU nest depth: 2, expected: 0 > > > > Fix this by rejecting sleepable programs early in > > bpf_kprobe_multi_link_attach(), before any further processing. > > > > Fixes: 0dcac272540613d41c05e89679e4ddb978b612f1 ("bpf: Add multi kprobe link") > > Please use the right format. > Fixes: 0dcac2725406 ("bpf: Add multi kprobe link") > > You can add the follow to your .gitconfig to generate the fixes tag. > [alias] > fixes = log -1 --format='Fixes: %h (\"%s\")' > > > Signed-off-by: Varun R Mallya <varunrmallya@gmail.com> > > --- > > kernel/trace/bpf_trace.c | 4 ++++ > > 1 file changed, 4 insertions(+) > > > > diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c > > index 0b040a417442..af7079aa0f36 100644 > > --- a/kernel/trace/bpf_trace.c > > +++ b/kernel/trace/bpf_trace.c > > @@ -2752,6 +2752,10 @@ int bpf_kprobe_multi_link_attach(const union bpf_attr *attr, struct bpf_prog *pr > > if (!is_kprobe_multi(prog)) > > return -EINVAL; > > > > + /* kprobe_multi is not allowed to be sleepable. */ > > + if (prog->sleepable) > > + return -EINVAL; > > + > > Looks ok to me, Jiri, could you also take a look? > > > /* Writing to context is not allowed for kprobes. */ > > if (prog->aux->kprobe_write_ctx) > > return -EINVAL; > > -- > > 2.53.0 > > Also, please add a selftest. pw-bot: cr ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH bpf v2] bpf: Reject sleepable kprobe_multi programs at attach time 2026-04-01 13:44 [BUG] bpf: kprobe_multi allows BPF_F_SLEEPABLE programs, causing sleeping-in-atomic splat Varun R Mallya 2026-04-01 13:49 ` [PATCH bpf] bpf: Reject sleepable kprobe_multi programs at attach time Varun R Mallya @ 2026-04-01 16:25 ` Varun R Mallya 2026-04-01 16:31 ` Kumar Kartikeya Dwivedi 1 sibling, 1 reply; 6+ messages in thread From: Varun R Mallya @ 2026-04-01 16:25 UTC (permalink / raw) To: varunrmallya Cc: andrii, ast, bpf, daniel, eddyz87, jolsa, kpsingh, linux-kernel, linux-trace-kernel, martin.lau, mathieu.desnoyers, mattbobrowski, memxor, mhiramat, rostedt, song, yonghong.song kprobe.multi programs run in atomic/RCU context and cannot sleep. However, bpf_kprobe_multi_link_attach() did not validate whether the program being attached had the sleepable flag set, allowing sleepable helpers such as bpf_copy_from_user() to be invoked from a non-sleepable context. This causes a "sleeping function called from invalid context" splat: BUG: sleeping function called from invalid context at ./include/linux/uaccess.h:169 in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 1787, name: sudo preempt_count: 1, expected: 0 RCU nest depth: 2, expected: 0 Fix this by rejecting sleepable programs early in bpf_kprobe_multi_link_attach(), before any further processing. Also add a selftest that tries to load a sleepable kprobe_multi program and it needs to be rejected for the test to pass. Fixes: 0dcac2725406 ("bpf: Add multi kprobe link") Signed-off-by: Varun R Mallya <varunrmallya@gmail.com> --- kernel/trace/bpf_trace.c | 4 ++ .../bpf/prog_tests/kprobe_multi_test.c | 41 +++++++++++++++++++ .../bpf/progs/kprobe_multi_sleepable.c | 13 ++++++ 3 files changed, 58 insertions(+) create mode 100644 tools/testing/selftests/bpf/progs/kprobe_multi_sleepable.c diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c index 0b040a417442..af7079aa0f36 100644 --- a/kernel/trace/bpf_trace.c +++ b/kernel/trace/bpf_trace.c @@ -2752,6 +2752,10 @@ int bpf_kprobe_multi_link_attach(const union bpf_attr *attr, struct bpf_prog *pr if (!is_kprobe_multi(prog)) return -EINVAL; + /* kprobe_multi is not allowed to be sleepable. */ + if (prog->sleepable) + return -EINVAL; + /* Writing to context is not allowed for kprobes. */ if (prog->aux->kprobe_write_ctx) return -EINVAL; diff --git a/tools/testing/selftests/bpf/prog_tests/kprobe_multi_test.c b/tools/testing/selftests/bpf/prog_tests/kprobe_multi_test.c index 78c974d4ea33..f02fec2b6fda 100644 --- a/tools/testing/selftests/bpf/prog_tests/kprobe_multi_test.c +++ b/tools/testing/selftests/bpf/prog_tests/kprobe_multi_test.c @@ -10,6 +10,7 @@ #include "kprobe_multi_session_cookie.skel.h" #include "kprobe_multi_verifier.skel.h" #include "kprobe_write_ctx.skel.h" +#include "kprobe_multi_sleepable.skel.h" #include "bpf/libbpf_internal.h" #include "bpf/hashmap.h" @@ -633,6 +634,44 @@ static void test_attach_write_ctx(void) } #endif +static void test_attach_multi_sleepable(void) +{ + struct kprobe_multi_sleepable *skel; + int err; + + skel = kprobe_multi_sleepable__open(); + if (!ASSERT_OK_PTR(skel, "kprobe_multi_sleepable__open")) + return; + + err = bpf_program__set_flags(skel->progs.handle_kprobe_multi_sleepable, + BPF_F_SLEEPABLE); + if (!ASSERT_OK(err, "bpf_program__set_flags")) + goto cleanup; + + /* Load should succeed even with BPF_F_SLEEPABLE for KPROBE types */ + err = kprobe_multi_sleepable__load(skel); + if (!ASSERT_OK(err, "kprobe_multi_sleepable__load")) + goto cleanup; + + /* Attachment must fail for kprobe.multi + BPF_F_SLEEPABLE. + * Also chosen a stable symbol to send into opts + */ + LIBBPF_OPTS(bpf_kprobe_multi_opts, opts); + const char *sym = "vfs_read"; + + opts.syms = &sym; + opts.cnt = 1; + + skel->links.handle_kprobe_multi_sleepable = + bpf_program__attach_kprobe_multi_opts(skel->progs.handle_kprobe_multi_sleepable, + NULL, &opts); + ASSERT_ERR_PTR(skel->links.handle_kprobe_multi_sleepable, + "bpf_program__attach_kprobe_multi_opts"); + +cleanup: + kprobe_multi_sleepable__destroy(skel); +} + void serial_test_kprobe_multi_bench_attach(void) { if (test__start_subtest("kernel")) @@ -676,5 +715,7 @@ void test_kprobe_multi_test(void) test_unique_match(); if (test__start_subtest("attach_write_ctx")) test_attach_write_ctx(); + if (test__start_subtest("attach_multi_sleepable")) + test_attach_multi_sleepable(); RUN_TESTS(kprobe_multi_verifier); } diff --git a/tools/testing/selftests/bpf/progs/kprobe_multi_sleepable.c b/tools/testing/selftests/bpf/progs/kprobe_multi_sleepable.c new file mode 100644 index 000000000000..56973ad8779d --- /dev/null +++ b/tools/testing/selftests/bpf/progs/kprobe_multi_sleepable.c @@ -0,0 +1,13 @@ +// SPDX-License-Identifier: GPL-2.0 + +#include "vmlinux.h" +#include <bpf/bpf_helpers.h> +#include <bpf/bpf_tracing.h> + +SEC("kprobe.multi") +int handle_kprobe_multi_sleepable(struct pt_regs *ctx) +{ + return 0; +} + +char _license[] SEC("license") = "GPL"; -- 2.53.0 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH bpf v2] bpf: Reject sleepable kprobe_multi programs at attach time 2026-04-01 16:25 ` [PATCH bpf v2] " Varun R Mallya @ 2026-04-01 16:31 ` Kumar Kartikeya Dwivedi 0 siblings, 0 replies; 6+ messages in thread From: Kumar Kartikeya Dwivedi @ 2026-04-01 16:31 UTC (permalink / raw) To: Varun R Mallya Cc: andrii, ast, bpf, daniel, eddyz87, jolsa, kpsingh, linux-kernel, linux-trace-kernel, martin.lau, mathieu.desnoyers, mattbobrowski, mhiramat, rostedt, song, yonghong.song On Wed, 1 Apr 2026 at 18:26, Varun R Mallya <varunrmallya@gmail.com> wrote: > > kprobe.multi programs run in atomic/RCU context and cannot sleep. > However, bpf_kprobe_multi_link_attach() did not validate whether the > program being attached had the sleepable flag set, allowing sleepable > helpers such as bpf_copy_from_user() to be invoked from a non-sleepable > context. > > This causes a "sleeping function called from invalid context" splat: > > BUG: sleeping function called from invalid context at ./include/linux/uaccess.h:169 > in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 1787, name: sudo > preempt_count: 1, expected: 0 > RCU nest depth: 2, expected: 0 > > Fix this by rejecting sleepable programs early in > bpf_kprobe_multi_link_attach(), before any further processing. > > Also add a selftest that tries to load a sleepable kprobe_multi program > and it needs to be rejected for the test to pass. > > Fixes: 0dcac2725406 ("bpf: Add multi kprobe link") > Signed-off-by: Varun R Mallya <varunrmallya@gmail.com> > --- Looks ok, but please split kernel fix and tests into separate patches, and no need to reply to this thread. pw-bot: cr > kernel/trace/bpf_trace.c | 4 ++ > .../bpf/prog_tests/kprobe_multi_test.c | 41 +++++++++++++++++++ > .../bpf/progs/kprobe_multi_sleepable.c | 13 ++++++ > 3 files changed, 58 insertions(+) > create mode 100644 tools/testing/selftests/bpf/progs/kprobe_multi_sleepable.c > > diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c > index 0b040a417442..af7079aa0f36 100644 > --- a/kernel/trace/bpf_trace.c > +++ b/kernel/trace/bpf_trace.c > @@ -2752,6 +2752,10 @@ int bpf_kprobe_multi_link_attach(const union bpf_attr *attr, struct bpf_prog *pr > if (!is_kprobe_multi(prog)) > return -EINVAL; > > + /* kprobe_multi is not allowed to be sleepable. */ > + if (prog->sleepable) > + return -EINVAL; > + > /* Writing to context is not allowed for kprobes. */ > if (prog->aux->kprobe_write_ctx) > return -EINVAL; > diff --git a/tools/testing/selftests/bpf/prog_tests/kprobe_multi_test.c b/tools/testing/selftests/bpf/prog_tests/kprobe_multi_test.c > index 78c974d4ea33..f02fec2b6fda 100644 > --- a/tools/testing/selftests/bpf/prog_tests/kprobe_multi_test.c > +++ b/tools/testing/selftests/bpf/prog_tests/kprobe_multi_test.c > @@ -10,6 +10,7 @@ > #include "kprobe_multi_session_cookie.skel.h" > #include "kprobe_multi_verifier.skel.h" > #include "kprobe_write_ctx.skel.h" > +#include "kprobe_multi_sleepable.skel.h" > #include "bpf/libbpf_internal.h" > #include "bpf/hashmap.h" > > @@ -633,6 +634,44 @@ static void test_attach_write_ctx(void) > } > #endif > > +static void test_attach_multi_sleepable(void) > +{ > + struct kprobe_multi_sleepable *skel; > + int err; > + > + skel = kprobe_multi_sleepable__open(); > + if (!ASSERT_OK_PTR(skel, "kprobe_multi_sleepable__open")) > + return; > + > + err = bpf_program__set_flags(skel->progs.handle_kprobe_multi_sleepable, > + BPF_F_SLEEPABLE); > + if (!ASSERT_OK(err, "bpf_program__set_flags")) > + goto cleanup; > + > + /* Load should succeed even with BPF_F_SLEEPABLE for KPROBE types */ > + err = kprobe_multi_sleepable__load(skel); > + if (!ASSERT_OK(err, "kprobe_multi_sleepable__load")) > + goto cleanup; > + > + /* Attachment must fail for kprobe.multi + BPF_F_SLEEPABLE. > + * Also chosen a stable symbol to send into opts > + */ > + LIBBPF_OPTS(bpf_kprobe_multi_opts, opts); > + const char *sym = "vfs_read"; > + > + opts.syms = &sym; > + opts.cnt = 1; > + > + skel->links.handle_kprobe_multi_sleepable = > + bpf_program__attach_kprobe_multi_opts(skel->progs.handle_kprobe_multi_sleepable, > + NULL, &opts); > + ASSERT_ERR_PTR(skel->links.handle_kprobe_multi_sleepable, > + "bpf_program__attach_kprobe_multi_opts"); > + > +cleanup: > + kprobe_multi_sleepable__destroy(skel); > +} > + > void serial_test_kprobe_multi_bench_attach(void) > { > if (test__start_subtest("kernel")) > @@ -676,5 +715,7 @@ void test_kprobe_multi_test(void) > test_unique_match(); > if (test__start_subtest("attach_write_ctx")) > test_attach_write_ctx(); > + if (test__start_subtest("attach_multi_sleepable")) > + test_attach_multi_sleepable(); > RUN_TESTS(kprobe_multi_verifier); > } > diff --git a/tools/testing/selftests/bpf/progs/kprobe_multi_sleepable.c b/tools/testing/selftests/bpf/progs/kprobe_multi_sleepable.c > new file mode 100644 > index 000000000000..56973ad8779d > --- /dev/null > +++ b/tools/testing/selftests/bpf/progs/kprobe_multi_sleepable.c > @@ -0,0 +1,13 @@ > +// SPDX-License-Identifier: GPL-2.0 > + > +#include "vmlinux.h" > +#include <bpf/bpf_helpers.h> > +#include <bpf/bpf_tracing.h> > + > +SEC("kprobe.multi") > +int handle_kprobe_multi_sleepable(struct pt_regs *ctx) > +{ > + return 0; > +} > + > +char _license[] SEC("license") = "GPL"; > -- > 2.53.0 > ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-04-01 16:31 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2026-04-01 13:44 [BUG] bpf: kprobe_multi allows BPF_F_SLEEPABLE programs, causing sleeping-in-atomic splat Varun R Mallya 2026-04-01 13:49 ` [PATCH bpf] bpf: Reject sleepable kprobe_multi programs at attach time Varun R Mallya 2026-04-01 14:08 ` Kumar Kartikeya Dwivedi 2026-04-01 14:42 ` Kumar Kartikeya Dwivedi 2026-04-01 16:25 ` [PATCH bpf v2] " Varun R Mallya 2026-04-01 16:31 ` Kumar Kartikeya Dwivedi
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox