[SRU][F][PATCH v2 0/1] UBUNTU: SAUCE: overlayfs: fix reference count mismatch
Andrea Righi
andrea.righi at canonical.com
Fri Jun 30 08:01:37 UTC 2023
BugLink: https://bugs.launchpad.net/bugs/2016398
[Impact]
Opened files reported in /proc/pid/map_files can be shows with the wrong
mount point using overlayfs with filesystem namspaces.
This incorrect behavior is fixed:
UBUNTU: SAUCE: overlayfs: fix incorrect mnt_id of files opened from map_files
However, the fix introduced a new regression, the reference to the
original file stored in vma->vm_prfile is not properly released when
vma->vm_prfile is replaced with a new file.
This can cause a reference counter unbalance, leading errors such as
"target is busy" when trying to unmount overlayfs, even if the
filesystem has not active reference.
[Test case]
Reproducer provided by original bug reporter:
https://launchpadlibrarian.net/663151659/overlayfsscript_example
[Fix]
Fix by properly releasing the original file stored in vm_prfile.
[Regression potential]
This fix seems to solve the reported bug (verified with the reproducer)
and it doesn't seem to introduce other regressions or behavior change.
However, we may experience regressions in overlayfs or potentially other
"target is busy" errors when unmounting overlayfs filesystems with this
fix applied, if there are still other corner cases not covered properly.
ChangeLog v1 -> v2:
- don't drop original fput() that would introduce another refcount leak
More information about the kernel-team
mailing list