Skip to content

Commit

Permalink
tools: Fix filelife for kernels without CONFIG_SECURITY
Browse files Browse the repository at this point in the history
security_inode_create presents only if CONFIG_SECURITY is on.
Do not attach to it unconditionally.

Signed-off-by: Hengqi Chen <[email protected]>
  • Loading branch information
chenhengqi authored and yonghong-song committed Mar 5, 2023
1 parent 9b5af1b commit a894979
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tools/filelife.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,8 @@
b.attach_kprobe(event="vfs_open", fn_name="trace_open")
# newer kernels (say, 4.8) may don't fire vfs_create, so record (or overwrite)
# the timestamp in security_inode_create():
b.attach_kprobe(event="security_inode_create", fn_name="trace_security_inode_create")
if BPF.get_kprobe_functions(b"security_inode_create"):
b.attach_kprobe(event="security_inode_create", fn_name="trace_security_inode_create")
b.attach_kprobe(event="vfs_unlink", fn_name="trace_unlink")

# header
Expand Down

0 comments on commit a894979

Please sign in to comment.