]> www.infradead.org Git - users/jedix/linux-maple.git/commit
bpf: Mark dentry->d_inode as trusted_or_null
authorSong Liu <song@kernel.org>
Fri, 13 Jun 2025 05:28:56 +0000 (22:28 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Tue, 17 Jun 2025 15:40:59 +0000 (08:40 -0700)
commita766cfbbeb3a74397965a8fa2e9a402026d3e1d8
tree24adc39841dec7916f7ae7ead60c890731e02c35
parent9afe652958c3ee88f24df1e4a97f298afce89407
bpf: Mark dentry->d_inode as trusted_or_null

LSM hooks such as security_path_mknod() and security_inode_rename() have
access to newly allocated negative dentry, which has NULL d_inode.
Therefore, it is necessary to do the NULL pointer check for d_inode.

Also add selftests that checks the verifier enforces the NULL pointer
check.

Signed-off-by: Song Liu <song@kernel.org>
Reviewed-by: Matt Bobrowski <mattbobrowski@google.com>
Link: https://lore.kernel.org/r/20250613052857.1992233-1-song@kernel.org
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
kernel/bpf/verifier.c
tools/testing/selftests/bpf/progs/verifier_vfs_accept.c
tools/testing/selftests/bpf/progs/verifier_vfs_reject.c