From: "Alexei Starovoitov" <alexei.starovoitov@gmail.com>
To: "Toke Høiland-Jørgensen" <toke@toke.dk>,
"Alexei Starovoitov" <ast@kernel.org>,
"Daniel Borkmann" <daniel@iogearbox.net>,
"Andrii Nakryiko" <andrii@kernel.org>,
"Eduard Zingerman" <eddyz87@gmail.com>,
"Kumar Kartikeya Dwivedi" <memxor@gmail.com>,
"Martin KaFai Lau" <martin.lau@linux.dev>,
"Song Liu" <song@kernel.org>,
"Yonghong Song" <yonghong.song@linux.dev>,
"Jiri Olsa" <jolsa@kernel.org>,
"Emil Tsalapatis" <emil@etsalapatis.com>,
"Ihor Solodrai" <ihor.solodrai@linux.dev>,
"John Fastabend" <john.fastabend@gmail.com>
Cc: <bpf@vger.kernel.org>
Subject: Re: [PATCH bpf-next v5 0/6] Improvements to access module BTF with bpf_token
Date: Sat, 05 Dec 2026 07:55:31 +0000 [thread overview]
Message-ID: <DNCMZ4YPRCWV.2E8INKUST1PV8@gmail.com> (raw)
In-Reply-To: <20261130-bpf-relax-get-next-id-v5-0-0a5507bc4d6e@toke.dk>
On Mon Nov 30, 2026 at 11:56 AM UTC, Toke Høiland-Jørgensen wrote:
> This series helps seamlessly run an application inside a user namespace
> with a bpf_token delegation. The need for these changes was discussed at
> my talk at this yeas's LPC:
>
> https://lpc.events/event/20/contributions/2441/
>
> The problem the series aims to fix is one we discovered while developing
> the bpf-rbacd application discussed in the talk: when delegating
> permissions with a bpf_token, a libbpf-based tracing application works
> seamlessly when it is attaching an fentry program to a function that is
> in vmlinux, but fails if it tries to attach the same program to a
> function that's defined in a module. There are two reasons for this:
>
> (1) When trying to find the BTF ID to attach to in the module, libbpf
> uses the BPF_BTF_GET_NEXT_ID command for the bpf() syscall, which
> requires global CAP_SYS_ADMIN.
>
> (2) Even with the issue above fixed, libbpf does not have the token
> available at the time it does the BTF iteration.
>
> The first patch relaxes the kernel's permission check to make it
> possible to iterate BTF objects with bpf_token permissions, fixing
> issue (1) above.
>
> Patches 2-4 changes libbpf's behaviour around accessing tokens so that
> token loading is done on object creation instead of on load, and passes
> in the token when iterating BTF objects in the kernel, fixing issue (2)
> above.
my bots found few bugs, but overall the series look good to me
and the bugs can be fixed in the follow ups.
Andrii,
please take a look.
This is something we discussed for quite some time.
> The change in patch 4 temporarily breaks the token selftests because it
> relies on the old behaviour. Patch 5 updates the selftests to fix this
> up. Finally, patch 6 adds a new test that checks that we can attach
> fentry programs to module functions inside a user namespace, which was
> the original issue resolved by this series.
it's fine.
prev parent reply other threads:[~2026-12-05 7:55 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-30 11:56 [PATCH bpf-next v5 0/6] Improvements to access module BTF with bpf_token Toke Høiland-Jørgensen
2026-11-30 11:56 ` [PATCH bpf-next v5 1/6] bpf: Allow BPF_*_GET_NEXT_ID permission checks to pass " Toke Høiland-Jørgensen
2026-11-30 11:56 ` [PATCH bpf-next v5 2/6] libbpf: Add bpf_btf_get_next_id_opts() function Toke Høiland-Jørgensen
2026-11-30 11:56 ` [PATCH bpf-next v5 3/6] libbpf: Move bpf_object_prepare_token() to object creation Toke Høiland-Jørgensen
2026-11-30 11:56 ` [PATCH bpf-next v5 4/6] libbpf: Pass in token_fd when iterating kernel BTF objects Toke Høiland-Jørgensen
2026-11-30 11:56 ` [PATCH bpf-next v5 5/6] selftests/bpf: Explicitly disable token in token/obj_priv_freplace_prog_fail test Toke Høiland-Jørgensen
2026-11-30 11:56 ` [PATCH bpf-next v5 6/6] selftests/bpf: Add test for attaching fentry to a module with bpf_token Toke Høiland-Jørgensen
2026-12-05 7:55 ` Alexei Starovoitov [this message]
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=DNCMZ4YPRCWV.2E8INKUST1PV8@gmail.com \
--to=alexei.starovoitov@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=emil@etsalapatis.com \
--cc=ihor.solodrai@linux.dev \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--cc=martin.lau@linux.dev \
--cc=memxor@gmail.com \
--cc=song@kernel.org \
--cc=toke@toke.dk \
--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