From: Matt Bobrowski <mattbobrowski@google.com>
To: Song Liu <song@kernel.org>
Cc: bpf@vger.kernel.org, Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Andrii Nakryiko <andrii@kernel.org>,
Martin KaFai Lau <martin.lau@linux.dev>,
Eduard Zingerman <eddyz87@gmail.com>,
Yonghong Song <yonghong.song@linux.dev>,
ohn Fastabend <john.fastabend@gmail.com>,
KP Singh <kpsingh@kernel.org>,
Stanislav Fomichev <sdf@fomichev.me>, Hao Luo <haoluo@google.com>,
Jiri Olsa <jolsa@kernel.org>, Kaiyan Mei <M202472210@hust.edu.cn>,
Yinhao Hu <dddddd@hust.edu.cn>, Dongliang Mu <dzm91@hust.edu.cn>
Subject: Re: [PATCH v2 bpf-next 1/2] bpf: annotate file argument as __nullable in bpf_lsm_mmap_file
Date: Tue, 16 Dec 2025 20:11:45 +0000 [thread overview]
Message-ID: <aUG9Ad2bGNVShE4_@google.com> (raw)
In-Reply-To: <CAPhsuW7cnX6G+YJf-W=RizoZf75286H9vmgh98VGe=kEhh6NMQ@mail.gmail.com>
On Wed, Dec 17, 2025 at 04:45:34AM +0900, Song Liu wrote:
> On Tue, Dec 16, 2025 at 5:30 AM Matt Bobrowski <mattbobrowski@google.com> wrote:
> [...]
> > diff --git a/kernel/bpf/Makefile b/kernel/bpf/Makefile
> > index 232cbc97434d..79cf22860a99 100644
> > --- a/kernel/bpf/Makefile
> > +++ b/kernel/bpf/Makefile
> > @@ -42,7 +42,17 @@ endif
> > ifeq ($(CONFIG_BPF_JIT),y)
> > obj-$(CONFIG_BPF_SYSCALL) += bpf_struct_ops.o
> > obj-$(CONFIG_BPF_SYSCALL) += cpumask.o
> > -obj-${CONFIG_BPF_LSM} += bpf_lsm.o
> > +# bpf_lsm_proto.o must precede bpf_lsm.o. The current pahole logic
> > +# deduplicates function prototypes within
> > +# btf_encoder__add_saved_func() by keeping the first instance seen. We
> > +# need the function prototype(s) in bpf_lsm_proto.o to take precedence
> > +# over those within bpf_lsm.o. Having bpf_lsm_proto.o precede
> > +# bpf_lsm.o ensures its DWARF CU is processed early, forcing the
> > +# generated BTF to contain the overrides.
> > +#
> > +# Notably, this is a temporary workaround whilst the deduplication
> > +# semantics within pahole are revisited accordingly.
>
> This is quite tricky, but I can confirm we need bpf_lsm_proto.o first.
Yes, agree, but it's an outright "hack" at this point. Note that I'm
also going to send a fix addressing a shortcoming within pahole, as
per this thread [0]. I'm just waiting to see what the BTF experts have
to say about it.
[0] https://lore.kernel.org/bpf/aTlFKI2IeHQ2-TSE@google.com/
next prev parent reply other threads:[~2025-12-16 20:11 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-16 13:29 [PATCH v2 bpf-next 1/2] bpf: annotate file argument as __nullable in bpf_lsm_mmap_file Matt Bobrowski
2025-12-16 13:30 ` [PATCH v2 bpf-next 2/2] selftests/bpf: add test case for BPF LSM hook bpf_lsm_mmap_file Matt Bobrowski
2025-12-16 19:45 ` Song Liu
2025-12-16 19:45 ` [PATCH v2 bpf-next 1/2] bpf: annotate file argument as __nullable in bpf_lsm_mmap_file Song Liu
2025-12-16 20:11 ` Matt Bobrowski [this message]
2025-12-22 0:56 ` Alexei Starovoitov
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=aUG9Ad2bGNVShE4_@google.com \
--to=mattbobrowski@google.com \
--cc=M202472210@hust.edu.cn \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=dddddd@hust.edu.cn \
--cc=dzm91@hust.edu.cn \
--cc=eddyz87@gmail.com \
--cc=haoluo@google.com \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--cc=kpsingh@kernel.org \
--cc=martin.lau@linux.dev \
--cc=sdf@fomichev.me \
--cc=song@kernel.org \
--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;
as well as URLs for NNTP newsgroup(s).