[Bug 272446] automount -c clobbers flags of mounted direct map entries

From: <bugzilla-noreply_at_freebsd.org>
Date: Mon, 10 Jul 2023 17:52:04 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=272446

            Bug ID: 272446
           Summary: automount -c clobbers flags of mounted direct map
                    entries
           Product: Base System
           Version: CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: bin
          Assignee: bugs@FreeBSD.org
          Reporter: andrew@tao11.riddles.org.uk

If you try and enable both the -media and -noauto maps from the sample
auto_master, and enable use of automount -c from devd as suggested in the
comments, then on every devd event, the flags of all the -noauto filesystems
are reset (clearing the "automounted" flag and, more critically, flags such as
"readonly" and "nosuid").

This happens because when traversing the mount list, there are two entries for
each -noauto map entry that is currently active: the autofs filesystem itself,
and the real filesystem mounted on top of it. The automount program sees the
first of those, and issues the equivalent of "mount -u /path" on it, WITHOUT
checking whether "/path" is currently mounted over.

This can be partially fixed in the userland code, but that obviously leaves a
race condition. Accordingly the attached review includes both a kernel and a
userland change: the kernel change is to require that the fstype field passed
to nmount does actually match the VFS type of the filesystem to be updated.

https://reviews.freebsd.org/D40961

-- 
You are receiving this mail because:
You are the assignee for the bug.