Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
audit: fix suffixed '/' filename matching in __audit_inode_child()
When the user specifies a directory to delete with the suffix '/', the audit record fails to collect the filename, resulting in the following logs: type=PATH msg=audit(10/30/2024 14:11:17.796:6304) : item=2 name=(null) type=PATH msg=audit(10/30/2024 14:11:17.796:6304) : item=1 name=(null) It happens because the value of the variables dname, and n->name->name in __audit_inode_child() differ only by the suffix '/'. This commit treats this corner case by handling pathname's trailing slashes in audit_compare_dname_path(). Steps to reproduce the issue: # auditctl -w /tmp $ mkdir /tmp/foo $ rm -r /tmp/foo/ # ausearch -i | grep PATH | tail -3 The first version of this patch was based on a GitHub patch/PR by user @hqh2010 [1]. Link: linux-audit/audit-kernel#148 [1] Suggested-by: Paul Moore <[email protected]> Reviewed-by: Richard Guy Briggs <[email protected]> Reviewed-by: Al Viro <[email protected]> Signed-off-by: Ricardo Robaina <[email protected]>
- Loading branch information