Skip to contentSkip to conversation

New: fanotify Ignoring/Excluding a Directory not working with FAN_MARK_MOUNT

Bug 215676 [email protected] 1 participant 2 messages Mar 12, 2022 – Mar 15, 2022

lore
Share & tools
lore
#0 lore raw

https://bugzilla.kernel.org/show_bug.cgi?id=215676

            Bug ID: 215676
           Summary: fanotify Ignoring/Excluding a Directory not working
                    with FAN_MARK_MOUNT
           Product: File System
           Version: 2.5
    Kernel Version: 5.11.0-27
          Hardware: All
                OS: Linux
              Tree: Mainline
            Status: NEW
          Severity: high
          Priority: P1
         Component: ext4
          Assignee: [email protected]
          Reporter: [email protected]
        Regression: No

Created attachment 300557
--> https://bugzilla.kernel.org/attachment.cgi?id=300557&action=edit
Test program to show directory exclusion not working

If a process calls fanotify_mark(fd, FAN_MARK_ADD | FAN_MARK_MOUNT, FAN_OPEN_PERM, 0, "/mountpoint") no other directory exclusions can be applied.

However a path (file) exclusion can still be applied using

fanotify_mark(fd, FAN_MARK_ADD | FAN_MARK_IGNORED_MASK | FAN_MARK_IGNORED_SURV_MODIFY, FAN_OPEN_PERM | FAN_CLOSE_WRITE, AT_FDCWD, "/tmp/fio/abc"); ===> path exclusion that works.

I think the directory exclusion not working is a bug as otherwise AV solutions cant exclude directories when using FAN_MARK_MOUNT.

I believe the change should be simple since we are already supporting path exclusions. So we should be able to add the same for the directory inode.

Signature · 4 lines
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.
#1 lore raw

[Bug 215676] fanotify Ignoring/Excluding a Directory not working with FAN_MARK_MOUNT

https://bugzilla.kernel.org/show_bug.cgi?id=215676

Jan Kara ([email protected]) changed:

What |Removed |Added
----------------------------------------------------------------------------

                 CC|                            |[email protected]
          Component|ext4                        |VFS
           Assignee|[email protected] |[email protected]
                   |g                           |

--- Comment #1 from Jan Kara ([email protected]) ---
This is the expected behavior, although there are workarounds and possible future improvements. More details in the email thread here:

https://lore.kernel.org/all/CAOQ4uxiDubhONM3w502anndtbqy73q_Kt5bOQ07zbATb8ndvVA@mail.gmail.com

Signature · 4 lines
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.