CVE-2026-139783: ovl: inherit FMODE_NONOTIFY when reading directory layers
In the Linux kernel, the following vulnerability has been resolved:
ovl: inherit FMODENONOTIFY when reading directory layers
Listing a merged or impure overlay directory opens the real layer directories from ovldirread(), when the readdir cache is filled. Those opens use plain ovlpathopen(), so when the directory fd is one that fanotify created for a permission event, they can still raise FSOPENPERM. A listener that also marks the backing filesystem and calls getdents() on the event fd before answering then deadlocks the same way as with the directory open fixed by the previous commit.
Store the overlay user file in struct ovlreaddirdata and pass it to ovlpathopenrealfile() from ovldirread(), for both the merged and the impure cache. Internal readers such as ovlcheckemptydir() and the mount-time workdir cleanup still pass no user file.
A note about severity and real world impact: The FANOPENPERM event is traditionally used by anti-malware protection agents and security/audit agents. The scope that is often used in those use cases is FANMARKMOUNT and agents typically monitor multiple mounts in a mount namespace. FANOPENPERM from directory open requires user opt-in with FANONDIR. It is often not the case that anti-malware agents monitor open of directories. Security/audit engines are more likely to opt-into FANOPENPERM on directories, but are less likely to list the content of a directory within the scope of FANOPENPERM event, so the real world impact of this bug is likely not significant.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 5.10.275 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 5.15.226 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 6.1.193 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 6.6.163 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 6.12.119 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 6.18.65 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 7.3.6 - Upgrade
Upgrade
debian/linuxto a version that resolves this vulnerability.Fixed in 7.3.6-1
Event History
Frequently Asked Questions
Which systems are realistically exposed to this deadlock?
Systems using overlayfs together with a fanotify listener that handles permission events are exposed in the described scenario. The practical use cases called out are anti-malware, security, and audit agents that use FAN_OPEN_PERM, often with FAN_MARK_MOUNT across multiple mounts in a mount namespace.
What actions are required to trigger the issue?
A fanotify-created directory file descriptor must be involved in reading a merged or impure overlay directory. The listener must also mark the backing filesystem and call getdents() on the event file descriptor before responding to the permission event, which can cause the listener to deadlock on another FS_OPEN_PERM event.
Are all overlayfs directory reads affected?
The affected paths are reads that fill the readdir cache for merged or impure overlay directories. Internal readers such as ovl_check_empty_dir() and mount-time workdir cleanup do not pass a user file and are identified separately in the fix description.