{"id":"CVE-2026-99824","summary":"fs: let backing files inherit FMODE_NONOTIFY from the user file","details":"In the Linux kernel, the following vulnerability has been resolved:\n\nfs: let backing files inherit FMODE_NONOTIFY from the user file\n\nWhen fanotify reports a permission event, copy_event_to_user() creates\nthe event fd with dentry_open_nonotify(), so that the listener's use of\nthat fd does not generate further events. If the event's path is on a\nstacked filesystem, the stacked filesystem's -\u003eopen() opens the real\nfile with backing_file_open(). Since commit ebe559609d78 (\"fs: get rid\nof __FMODE_NONOTIFY kludge\"), FMODE_NONOTIFY lives in f_mode only and\nthe backing file does not inherit it: it is allocated with the default\nfsnotify mode, and fsnotify_open_perm_and_set_mode() raises FS_OPEN_PERM\non the real path if the backing filesystem has permission event\nwatchers.\n\nBefore that commit __FMODE_NONOTIFY travelled in f_flags, and overlayfs\ncopies the user file's f_flags into the backing open\n(ovl_open_realfile()), so the backing file was exempt implicitly. Commit\nbc2473c90fca (\"ovl: enable fsnotify events on underlying real files\")\nrelied on that when it dropped FMODE_NONOTIFY from OVL_OPEN_FLAGS.\n\nThe nested event is queued to the same group, from inside the\nlistener's read(2), and can only be answered by another reader thread\nof that group. A listener holding filesystem marks on both the stacked\nand the backing filesystem therefore deadlocks as soon as all of its\nreader threads are inside such a read(2) at the same time, and every\nother task that touches a marked filesystem queues up behind it.\n\nObserved with a commercial anti-malware agent (16 reader threads) on an\nostree/composefs host: / is an overlayfs whose data layer is the ostree\nobject store on the same btrfs that holds /etc and /home, and a\nsystemd-sysext overlay sits on /usr. Every on-demand scan of /usr wedged\nthe whole machine until the group was killed. Stack of a blocked reader\nthread on 7.2.7:\n\n  fanotify_get_response\n  fanotify_handle_event\n  send_to_group\n  fsnotify\n  __fsnotify_parent\n  do_dentry_open\n  vfs_open\n  backing_file_open\n  ovl_open_realfile [overlay]\n  ovl_open [overlay]\n  do_dentry_open\n  vfs_open\n  backing_file_open\n  ovl_open_realfile [overlay]\n  ovl_open [overlay]\n  do_dentry_open\n  vfs_open\n  dentry_open_nonotify\n  copy_event_to_user\n  fanotify_read\n  vfs_read\n  ksys_read\n\nUserspace cannot avoid this: the backing open happens while the kernel\nbuilds the fd, before the event is reported, and fid reporting is not\navailable for permission event classes.\n\nMake a backing file inherit FMODE_NONOTIFY when the user file it is\nopened for must not generate events. This restores the pre-6.14\nbehaviour for the fds that fanotify creates (and for any other\nFMODE_NONOTIFY file), while ordinary opens through a stacked filesystem\nkeep generating events on the real path, as intended by bc2473c90fca.\n\nVerified with a self-contained reproducer (private tmpfs lower layers, an\noverlayfs over them, FAN_OPEN_PERM filesystem marks on the overlay and on\none lower layer, a child opening a file through the overlay) in a qemu\nVM on this tree built with defconfig plus OVERLAY_FS, FANOTIFY and\nFANOTIFY_ACCESS_PERMISSIONS: without this patch the listener's read(2)\nnever returns and the child's open is released only by the listener's\ndeath; with it read(2) returns, the event is answered and the open\ncompletes.\n\nbacking_tmpfile_open() is left alone: its only caller is\novl_create_tmpfile(), whose user file is a regular overlayfs file.","modified":"2026-11-30T15:02:31.805417370Z","published":"2026-11-30T13:17:21.586Z","database_specific":{"cna_assigner":"Linux","osv_generated_from":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/99xxx/CVE-2026-99824.json"},"references":[{"type":"PACKAGE","url":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git"},{"type":"WEB","url":"https://git.kernel.org/stable/c/0da582bda88a6b0621aa9c6305354a14244bd922"},{"type":"WEB","url":"https://git.kernel.org/stable/c/c3d355f427cea70fbe31b49e21f1915dbf37f2e6"},{"type":"WEB","url":"https://git.kernel.org/stable/c/cee09adbabd1a15e6f22b421f836a55782ab0707"},{"type":"ADVISORY","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/99xxx/CVE-2026-99824.json"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-99824"}],"affected":[{"ranges":[{"type":"GIT","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","events":[{"introduced":"ebe559609d7829b52c6642b581860760984faf9d"},{"fixed":"0da582bda88a6b0621aa9c6305354a14244bd922"},{"fixed":"cee09adbabd1a15e6f22b421f836a55782ab0707"},{"fixed":"c3d355f427cea70fbe31b49e21f1915dbf37f2e6"}]}],"database_specific":{"source":"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2026-99824.json"}},{"package":{"name":"Kernel","ecosystem":"Linux"},"ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"6.14.0"},{"fixed":"6.18.63"}]},{"type":"ECOSYSTEM","events":[{"introduced":"6.19.0"},{"fixed":"7.3.4"}]}],"database_specific":{"source":"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2026-99824.json"}}],"schema_version":"1.9.2"}