freebsd-skq/sys/fs/nullfs
Konstantin Belousov 76b1b5ce6d nullfs: protect against user creating inconsistent state
The VFS conventions is that VOP_LOOKUP() methods do not need to handle
ISDOTDOT lookups for VV_ROOT vnodes (since they cannot, after all).  Nullfs
bypasses VOP_LOOKUP() to lower filesystem, and there, due to user actions,
it is possible to get into situation where
- upper vnode does not have VV_ROOT set
- lower vnode is root
- ISDOTDOT is requested
User just needs to nullfs-mount non-root of some filesystem, and then move
some directory under mount, out of mount, using lower filesystem.

In this case, nullfs cannot do much, but we still should and can ensure
internal kernel structures are consistent.  Avoid ISDOTDOT lookup forwarding
when VV_ROOT is set on lower dvp, return somewhat arbitrary ENOENT.

PR:	253593
Reported by:	Gregor Koscak <elogin41@gmail.com>
Test by:	Patrick Sullivan <sulli00777@gmail.com>
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2021-04-02 15:40:25 +03:00
..
null_subr.c vfs: add v_irflag accessors 2021-01-03 06:50:06 +00:00
null_vfsops.c Make it possible to mount nullfs(5) using plain mount(8) 2020-10-29 15:28:15 +00:00
null_vnops.c nullfs: protect against user creating inconsistent state 2021-04-02 15:40:25 +03:00
null.h Save lower root vnode in nullfs mnt data instead of upper. 2020-01-28 11:29:06 +00:00