History

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.

Jiri Olsa committed 6 years ago

Commit a8a71791 parent c69d2dd3 files · +26 −1Browse files

Showing the changes to kernel (1 of 3 files). Show all

Unified · Split

kernel/trace/bpf_trace.c+8−0
@@ -1114,6 +1114,14 @@ BPF_CALL_3(bpf_d_path, struct path *, path, char *, buf, u32, sz) · 1113 unmodified lines
11141114 }
11151115
11161116 BTF_SET_START(btf_allowlist_d_path)
1117+#ifdef CONFIG_SECURITY
1118+BTF_ID(func, security_file_permission)
1119+BTF_ID(func, security_inode_getattr)
1120+BTF_ID(func, security_file_open)
1121+#endif
1122+#ifdef CONFIG_SECURITY_PATH
1123+BTF_ID(func, security_path_truncate)
1124+#endif
11171125 BTF_ID(func, vfs_truncate)
11181126 BTF_ID(func, vfs_fallocate)
11191127 BTF_ID(func, dentry_open)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t