I accidentally got my invocation backwards, was impatient and tried the opposite form and it blew up looking in the VOP code when I did the following: 1. Boot 9.0-RELEASE as a LiveCD. 2. Execute the following commands: mkdir /tmp/etc mount_unionfs /tmp/etc /etc mount_unionfs /etc /tmp/etc 3. Accessing either /etc or /tmp/etc after that should result in a panic.
Responsible Changed From-To: freebsd-bugs->freebsd-fs Over to maintainer(s).
You could around this issue with a following patch. http://people.freebsd.org/~daichi/unionfs/unionfs-cross-mount3.diff And above patch is rejected at ml discussion some years ago. We need more radical changes to improve this kind of issues. -- Daichi GOTO 81-42-316-7945 | daichi@ongs.co.jp | http://www.ongs.co.jp LinkedIn: http://linkedin.com/in/daichigoto
I finally got around to testing this. Yup -- the patch looks good to me. Thank you Daichi! -Garrett
ping
batch change: For bugs that match the following - Status Is In progress AND - Untouched since 2018-01-01. AND - Affects Base System OR Documentation DO: Reset to open status. Note: I did a quick pass but if you are getting this email it might be worthwhile to double check to see if this bug ought to be closed.
See comments 9 & 10 on https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=275871 for a more recent reproduction.
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=0247b4018de2c341ac59a585362c10044cea86ad commit 0247b4018de2c341ac59a585362c10044cea86ad Author: Jason A. Harmening <jah@FreeBSD.org> AuthorDate: 2025-11-29 07:53:16 +0000 Commit: Jason A. Harmening <jah@FreeBSD.org> CommitDate: 2025-12-12 06:32:05 +0000 unionfs: detect common deadlock-producing mount misconfigurations When creating a unionfs mount, it's fairly easy to shoot oneself in the foot by specifying upper and lower file hierarchies that resolve back to the same vnodes. This is fairly easy to do if the sameness is not obvious due to aliasing through nullfs or other unionfs mounts (as in the associated PR), and will produce either deadlock or failed locking assertions on any attempt to use the resulting unionfs mount. Leverage VOP_GETLOWVNODE() to detect the most common cases of foot-shooting at mount time and fail the mount with EDEADLK. This is not meant to be an exhaustive check for all possible deadlock-producing scenarios, but it is an extremely cheap and simple approach that, unlike previous proposed fixes, also works in the presence of nullfs aliases. PR: 172334 Reported by: ngie, Karlo Miličević <karlo98.m@gmail.com> Reviewed by: kib, olce Tested by: pho MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D53988 sys/fs/unionfs/union_vfsops.c | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-)
^Triage: committed via D53988.
A commit in branch stable/15 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=da6f395119a5eb1ed1dad56874c1c55a5721e220 commit da6f395119a5eb1ed1dad56874c1c55a5721e220 Author: Jason A. Harmening <jah@FreeBSD.org> AuthorDate: 2025-11-29 07:53:16 +0000 Commit: Jason A. Harmening <jah@FreeBSD.org> CommitDate: 2025-12-26 06:38:06 +0000 unionfs: detect common deadlock-producing mount misconfigurations When creating a unionfs mount, it's fairly easy to shoot oneself in the foot by specifying upper and lower file hierarchies that resolve back to the same vnodes. This is fairly easy to do if the sameness is not obvious due to aliasing through nullfs or other unionfs mounts (as in the associated PR), and will produce either deadlock or failed locking assertions on any attempt to use the resulting unionfs mount. Leverage VOP_GETLOWVNODE() to detect the most common cases of foot-shooting at mount time and fail the mount with EDEADLK. This is not meant to be an exhaustive check for all possible deadlock-producing scenarios, but it is an extremely cheap and simple approach that, unlike previous proposed fixes, also works in the presence of nullfs aliases. PR: 172334 Reported by: ngie, Karlo Miličević <karlo98.m@gmail.com> Reviewed by: kib, olce Tested by: pho Differential Revision: https://reviews.freebsd.org/D53988 (cherry picked from commit 0247b4018de2c341ac59a585362c10044cea86ad) sys/fs/unionfs/union_vfsops.c | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-)