selftests/bpf: Fix stat probe in d_path test
Some kernels builds might inline vfs_getattr call within fstat
syscall code path, so fentry/vfs_getattr trampoline is not called.
Add security_inode_getattr to allowlist and switch the d_path test stat
trampoline to security_inode_getattr.
Keeping dentry_open and filp_close, because they are in their own
files, so unlikely to be inlined, but in case they are, adding
security_file_open.
Adding flags that indicate trampolines were called and failing
the test if any of them got missed, so it's easier to identify
the issue next time.
Fixes: e4d1af4b16 ("selftests/bpf: Add test for d_path helper")
Suggested-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20200918112338.2618444-1-jolsa@kernel.org
This commit is contained in:
committed by
Alexei Starovoitov
parent
c69d2ddb20
commit
a8a717963f
@@ -1114,6 +1114,14 @@ BPF_CALL_3(bpf_d_path, struct path *, path, char *, buf, u32, sz)
|
||||
}
|
||||
|
||||
BTF_SET_START(btf_allowlist_d_path)
|
||||
#ifdef CONFIG_SECURITY
|
||||
BTF_ID(func, security_file_permission)
|
||||
BTF_ID(func, security_inode_getattr)
|
||||
BTF_ID(func, security_file_open)
|
||||
#endif
|
||||
#ifdef CONFIG_SECURITY_PATH
|
||||
BTF_ID(func, security_path_truncate)
|
||||
#endif
|
||||
BTF_ID(func, vfs_truncate)
|
||||
BTF_ID(func, vfs_fallocate)
|
||||
BTF_ID(func, dentry_open)
|
||||
|
||||
Reference in New Issue
Block a user