Re: [PATCH bpf-next v5 4/7] bpf: Allow reads through trusted-or-null BTF pointers
From: Anastasios Papagiannis
Date: Tue Sep 08 2026 - 07:55:56 EST
Thanks for the review!
> We tried doing this before in
> https://lore.kernel.org/bpf/20241104171959.2938862-2-memxor@xxxxxxxxx and it
> got reverted, it broke all sorts of things and made everything more complex.
Out of curiosity, what were the main issues caused by that change?
> I would drop this hack and just fix the program. Given your earlier change to
> annotate the field correctly, I am puzzled why you added this, and there isn't
> any description anywhere explaining why.
Initially, in v1, I only marked linux_binprm->mm as trusted-or-null in [1] where
I also needed to update a test. But I got an AI review comment in [2] that this
change breaks the BPF load-compatibility guarantee documented in
Documentation/bpf/bpf_design_QA.rst.
For this reason, I took a simpler approach in [3] where Andrii commented in [4]
that we might want to look into having verifier still allow to dereference
trusted ptr-or-null into untrusted ptr_to_btf_id to help with smooth transitions
like this or just marked linux_binprm->mm as trusted-or-null (ignoring the issue
about breaking the BPF load-compatibility guarantee).
So I tried the more "risky" approach first. This was the full story behind this
change.
To summarise: are you ok with removing this patch (and the next one with the tests)
and fall back to something like [1]?
[1] https://lore.kernel.org/bpf/20260811112154.94053-1-tasos.papagiannnis@xxxxxxxxx/T/#m295ed4ae8a717ac4cdf536585f150590faa2c40c
[2] https://lore.kernel.org/bpf/20260811112154.94053-1-tasos.papagiannnis@xxxxxxxxx/T/#mc0865ac61ab3ffb1acb720e42b35ea65469442b5
[3] https://lore.kernel.org/bpf/20260820131801.68759-1-tasos.papagiannnis@xxxxxxxxx/
[4] https://lore.kernel.org/bpf/20260820131801.68759-1-tasos.papagiannnis@xxxxxxxxx/T/#mf5cd6a81c2e8231999ed2e4b991e060cfc4ca7d9
Thanks,
Anastasios