Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 17 Jun 2004 10:55:49 -1000
From:      Clifton Royston <cliftonr@lava.net>
To:        hackers@freebsd.org
Subject:   Sticky/sgid/suid bits safe on regular files?
Message-ID:  <20040617205549.GA19254@lava.net>

next in thread | raw e-mail | index | archive | help
  I need to add a feature to an application where it can keep tabs on
whether one specific action has ever been taken on any given file, one
of possibly hundreds of thousands of a dynamically changing file set. 
The files might reside either on an NFS server or on local storage, and
may ultimately be accessed by multiple servers; we also don't want to
alter the contents of the file.  It's essentially a mail-queue type of
situation.

  It would be very convenient if we can simply set some unused mode bit
on the file when we perform this action, so it doesn't need to be
tracked in a shared database.  I've verified that the chmods can be
performed over a FreeBSD mount of the NFS server.  AFAICT from the
FreeBSD docs and man pages, the sticky bit would be safe to use for
this, and has no hidden side effects for a non-directory; in this case,
the sgid or suid bits should also be OK to use given that the file is
non-executable.

  However, I have a nagging memory that there have been some Unices
where the sticky bit did various poorly-documented implementation-
specific "magic" things on regular files, e.g. causing them to be
hardwired into the buffer cache, or locked out of the buffer cache.

  Can anybody confirm for me that the suid, sgid, and sticky bit are in
fact no-ops for FreeBSD on regular non-executable files, as it appears
they should be?

  -- Clifton

-- 
          Clifton Royston  --  cliftonr@tikitechnologies.com 
         Tiki Technologies Lead Programmer/Software Architect
Did you ever fly a kite in bed?  Did you ever walk with ten cats on your head?
  Did you ever milk this kind of cow?  Well we can do it.  We know how.
If you never did, you should.  These things are fun, and fun is good.
                                                                 -- Dr. Seuss



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040617205549.GA19254>