Skip to content

Conversation

@mattbobrowski
Copy link
Contributor

No description provided.

Kernel Patches Daemon and others added 3 commits December 5, 2025 16:59
Provide a strong override for BPF LSM hook
mmap_file() (bpf_lsm_mmap_file()) such that __nullable suffix
parameter semantics (PTR_MAYBE_NULL) can be enforced by the BPF
verifier onto the supplied BPF LSM program context. By doing this we
force BPF LSM programs attached to mmap_file() (bpf_lsm_mmap_file())
to fundamentally have to NULL check the supplied struct file pointer
parameter before attempting to dereference it, and therefore alleviate
the risk of running into trivial NULL pointer dereference bugs, such
as those reported in [0].

[0] https://lore.kernel.org/bpf/[email protected]/

Reported-by: Kaiyan Mei <[email protected]>
Reported-by: Yinhao Hu <[email protected]>
Reviewed-by: Dongliang Mu <[email protected]>
Closes: https://lore.kernel.org/bpf/[email protected]/
Signed-off-by: Matt Bobrowski <[email protected]>
Add a trivial test case asserting that the BPF verifier does enforce
__nullable suffix parameter semantics onto the struct file pointer
parameter of BPF LSM hook bpf_lsm_mmap_file(). Dereferences on this
struct file pointer without performing a NULL check are not to be
permitted by the BPF verifier as a direct dereference on it could very
well lead to a NULL pointer dereference.

Signed-off-by: Matt Bobrowski <[email protected]>
@kernel-patches-daemon-bpf kernel-patches-daemon-bpf bot force-pushed the bpf-next_base branch 4 times, most recently from 3119ae5 to 162c0b3 Compare December 14, 2025 03:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant