From: Jiri Olsa <olsajiri@gmail.com>
To: bot+bpf-ci@kernel.org
Cc: ast@kernel.org, daniel@iogearbox.net, bpf@vger.kernel.org,
linux-mm@kvack.org, andrii@kernel.org, eddyz87@gmail.com,
memxor@gmail.com, ljs@kernel.org, john.fastabend@gmail.com,
nierro92@gmail.com, martin.lau@kernel.org,
yonghong.song@linux.dev, mason@kernel.org,
ihor.solodrai@linux.dev
Subject: Re: [PATCHv2 bpf-next 8/8] selftests/bpf: Test user memory kfunc errors
Date: Wed, 4 Nov 2026 22:38:31 +0100 [thread overview]
Message-ID: <auul10Zrq0WmmU5K@krava> (raw)
In-Reply-To: <28b71b95a782f28f081233a18a48ab18cfb5483df6ec6980f8168cbecfd93543@mail.kernel.org>
On Tue, Nov 03, 2026 at 08:39:48AM +0000, bot+bpf-ci@kernel.org wrote:
> > selftests/bpf: Test user memory kfunc errors
>
> TL;DR: Test nit only: the user_mem_kprobe() selftest looks redundant with
> user_mem_nonsleepable(), since both have the same body and expected failure
> and load as the same program type. One may be droppable.
>
> > diff --git a/tools/testing/selftests/bpf/progs/user_mem.c b/tools/testing/selftests/bpf/progs/user_mem.c
> > --- a/tools/testing/selftests/bpf/progs/user_mem.c
> > +++ b/tools/testing/selftests/bpf/progs/user_mem.c
>
> [ ... ]
>
> > @@ -80,3 +80,32 @@ int user_mem_test(struct pt_regs *ctx)
> > +SEC("?uprobe//proc/self/exe:user_mem_trigger")
> > +__failure
> > +__msg("program must be sleepable to call sleepable kfunc bpf_user_anon_mmap")
> > +__msg("cannot be used in non-sleepable program")
> > +int user_mem_nonsleepable(struct pt_regs *ctx)
> > +{
> > + bpf_user_anon_mmap(4096, 1);
> > + return 0;
> > +}
> > +
> > +SEC("?kprobe")
> > +__failure
> > +__msg("program must be sleepable to call sleepable kfunc bpf_user_anon_mmap")
> > +__msg("cannot be used in non-sleepable program")
> > +int user_mem_kprobe(struct pt_regs *ctx)
> > +{
> > + bpf_user_anon_mmap(4096, 1);
> > + return 0;
> > +}
>
> This isn't a bug, but user_mem_kprobe() has the same body and the same
> __failure and __msg() annotations as user_mem_nonsleepable() above it.
>
> Since SEC("kprobe") and SEC("uprobe") both load as BPF_PROG_TYPE_KPROBE
> and the attach target is not used at load time, does user_mem_kprobe()
> test anything that user_mem_nonsleepable() does not, or could one of the
> two be dropped?
yep, will drop one
jirka
next prev parent reply other threads:[~2026-11-04 21:38 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-03 7:59 [PATCHv2 bpf-next 0/8] bpf: Add user memory kfuncs Jiri Olsa
2026-11-03 7:59 ` [PATCHv2 bpf-next 1/8] bpf: Honor const on generic kfunc memory arguments Jiri Olsa
2026-11-03 8:52 ` bot+bpf-ci
2026-11-03 18:03 ` Alexei Starovoitov
2026-11-03 21:36 ` Jiri Olsa
2026-11-03 7:59 ` [PATCHv2 bpf-next 2/8] bpf: Add user memory kfuncs Jiri Olsa
2026-11-03 8:19 ` sashiko-bot
2026-11-03 8:52 ` bot+bpf-ci
2026-11-03 18:05 ` Alexei Starovoitov
2026-11-03 21:36 ` Jiri Olsa
2026-11-03 7:59 ` [PATCHv2 bpf-next 3/8] selftests/bpf: Add get_procmap_info helper Jiri Olsa
2026-11-03 7:59 ` [PATCHv2 bpf-next 4/8] selftests/bpf: Test const kfunc memory arguments Jiri Olsa
2026-11-03 8:10 ` sashiko-bot
2026-11-04 21:12 ` Jiri Olsa
2026-11-03 7:59 ` [PATCHv2 bpf-next 5/8] selftests/bpf: Test user memory mmap kfuncs Jiri Olsa
2026-11-03 8:05 ` sashiko-bot
2026-11-04 21:09 ` Jiri Olsa
2026-11-03 7:59 ` [PATCHv2 bpf-next 6/8] selftests/bpf: Test user memory page exec Jiri Olsa
2026-11-03 8:39 ` bot+bpf-ci
2026-11-04 21:12 ` Jiri Olsa
2026-11-03 7:59 ` [PATCHv2 bpf-next 7/8] selftests/bpf: Test bpf_copy_to_user kfunc Jiri Olsa
2026-11-03 7:59 ` [PATCHv2 bpf-next 8/8] selftests/bpf: Test user memory kfunc errors Jiri Olsa
2026-11-03 8:39 ` bot+bpf-ci
2026-11-04 21:38 ` Jiri Olsa [this message]
2026-11-03 18:08 ` [PATCHv2 bpf-next 0/8] bpf: Add user memory kfuncs Alexei Starovoitov
2026-11-03 21:36 ` Jiri Olsa
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=auul10Zrq0WmmU5K@krava \
--to=olsajiri@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bot+bpf-ci@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=ihor.solodrai@linux.dev \
--cc=john.fastabend@gmail.com \
--cc=linux-mm@kvack.org \
--cc=ljs@kernel.org \
--cc=martin.lau@kernel.org \
--cc=mason@kernel.org \
--cc=memxor@gmail.com \
--cc=nierro92@gmail.com \
--cc=yonghong.song@linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox