Re: RFC: checking file systems support UF_HIDDEN, UF_SYSTEM

From: Shawn Webb <shawn.webb_at_hardenedbsd.org>
Date: Wed, 02 Jul 2025 21:54:45 UTC
On Wed, Jul 02, 2025 at 02:45:58PM -0700, Rick Macklem wrote:
> On Wed, Jul 2, 2025 at 2:05 PM Shawn Webb <shawn.webb@hardenedbsd.org> wrote:
> >
> > On Wed, Jul 02, 2025 at 02:02:14PM -0700, Rick Macklem wrote:
> > > Hi,
> > >
> > > I am implementing the "hidden" and "system" attributes for
> > > NFSv4 using UF_HIDDEN and UF_SYSTEM.
> > >
> > > In a couple of places in the code, I need to know if a file
> > > system supports these flags.
> > > I can think of two ways to do this.
> > > #1 - Create a new VFCF_HIDSYS flag that is set via VFS_SET()
> > >        for file systems that support the UF_HIDDEN and UF_SYSTEM
> > >        flags and test for that flag being set.
> > > or
> > > #2 - Write it this way...
> > >       if (strcmp(vp->v_mount->mnt_vfc->vfc_name, "zfs") != 0 ||
> > >           strcmp(vp->v_mount->mnt_vfc->vfc_name, "ufs") != 0 ||
> > >           strcmp(vp->v_mount->mnt_vfc->vfc_name, "msdosfs") != 0 ||
> > >           strcmp(vp->v_mount->mnt_vfc->vfc_name, "tmpfs") != 0)
> > >
> > > Which do you think is preferable (or do you have another idea)?
> >
> > I have no skin in the game, but I'm curious if you could tell me more
> > about UF_HIDDEN. Can you explain what that is or perhaps link me to
> > some documentation for me to read?
> I don't know why or when these were added to FreeBSD, but I believe
> their origin is in MSDOS long ago. The fat file system had these two flags
> that MSDOS used, called "hiiden" and "system".
> I believe "hidden" is somewhat similar to POSIX file
> names that start with "." and "system" made the file harder to delete.
> (But, I hate to admit I even recall anything about MSDOS;-)
> 
> If you google "windows system and hidden" you'll get something that
> might answer your question, thanks to their AI.
> 
> W.r.t. NFSv4, the current interest is from the group that is working
> on the Windows NFSv4.1 client.

That explains a lot. Thanks for the explanation!

-- 
Shawn Webb
Cofounder / Security Engineer
HardenedBSD

Signal Username:  shawn_webb.74
Tor-ified Signal: +1 303-901-1600 / shawn_webb_opsec.50
https://git.hardenedbsd.org/hardenedbsd/pubkeys/-/raw/master/Shawn_Webb/03A4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc