Repository navigation
Conversation
This was referenced Nov 12, 2026
Open
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #539: fanotify with pidfds and mount events.
FAN_REPORT_PIDFDandFAN_REPORT_TIDcame in #643. This PR addsFAN_REPORT_MNT, as fs/notify/fanotify of Linux 7.3.What changes
fanotify_initacceptsFAN_REPORT_MNT. It givesEINVALwhen the class is notFAN_CLASS_NOTIF, and when the flags also have a FID flag orFAN_REPORT_FD_ERROR. An unprivileged user can make such a group, as in Linux.fanotify_markacceptsFAN_MARK_MNTNS. A group withFAN_REPORT_MNTmarks only mount namespaces, with onlyFAN_MNT_ATTACHandFAN_MNT_DETACH. The other groups getEINVALfor these events and for this mark type. The path must be a mount namespace file of nsfs, such as/proc/self/ns/mnt, else the result isEINVAL. The mark needsCAP_SYS_ADMINin the user namespace of the group and in the user namespace that owns the mount namespace, else the result isEPERM.mnt_notifyof Linux:FAN_MNT_ATTACHwhen a mount is attached,FAN_MNT_DETACHon unmount, and both bits in one event on a move. ForMOVE_MOUNT_BENEATHonly the moved mount has an event. Forpivot_rootthe old root moves first, then the new root.fdisFAN_NOFD. After the pidfd record it has a 16 byteFAN_EVENT_INFO_TYPE_MNTrecord (type 7, len 16, 4 bytes of padding, then the unique mount ID ofstatxSTATX_MNT_ID_UNIQUE).fsnotify_mntns_delete.fanotify mnt_ns:INO mflags:X mask:X ignored_mask:X.Tests
LTP 20260930 has no test for
FAN_REPORT_MNT, so theinitboot test has a new check (only fanotify). It checks theEINVALcases offanotify_initandfanotify_mark, the fdinfo line, the event of a tmpfs mount with the ID fromstatx, the event ofMS_MOVE, the event ofumount, andEAGAINafter the events. It also checks that a user without privilege getsEPERMon the mount namespace of the initial user namespace, and can mark the mount namespace of its own user namespace.initboot test withonly fanotify: x86_64 pass (17 checks), arm64 pass (17 checks). Load average 18.9 to 22.3 on server2.The full gate did not run.