From owner-freebsd-hackers@FreeBSD.ORG Tue Jun 22 14:19:11 2004 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6993116A4CE for ; Tue, 22 Jun 2004 14:19:11 +0000 (GMT) Received: from thebsh.namesys.com (thebsh.namesys.com [212.16.7.65]) by mx1.FreeBSD.org (Postfix) with SMTP id 74FEA43D3F for ; Tue, 22 Jun 2004 14:19:10 +0000 (GMT) (envelope-from Nikita@Clusterfs.COM) Received: (qmail 28528 invoked from network); 22 Jun 2004 14:18:35 -0000 Received: from laputa.namesys.com (212.16.7.124) by thebsh.namesys.com with SMTP; 22 Jun 2004 14:18:35 -0000 Received: by laputa.namesys.com (Postfix on SuSE Linux 8.0 (i386), from userid 511) id 8A2D312E88; Tue, 22 Jun 2004 18:18:34 +0400 (MSD) From: Nikita Danilov MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <16600.16314.518796.463218@laputa.namesys.com> Date: Tue, 22 Jun 2004 18:18:34 +0400 To: Dan Strick In-Reply-To: <200406221217.i5MCHYvj003485@mist.nodomain> References: <200406221217.i5MCHYvj003485@mist.nodomain> X-Mailer: VM 7.17 under 21.5 (patch 17) "chayote" (+CVS-20040321) XEmacs Lucid X-Mailman-Approved-At: Wed, 23 Jun 2004 12:06:57 +0000 cc: freebsd-hackers@freebsd.org cc: dan@mist.nodomain Subject: Re: Sticky/sgid/suid bits safe on regular files? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Jun 2004 14:19:11 -0000 Dan Strick writes: > Daniel O'Connor wrote: > >> > > I think he wanted to use sticky/sgid/suid because they get removed > > when the file is changed. > >> > > and Dag-Erling S?rgrav responded: > >> > > no they don't. > >> > > Actually, they do. (just the sgid/suid bits) > > I believe this was an ancient BSD security enhancement in case > someone accidentally left a world writeable suid file around. That is Single Unix Specification requirement: Upon successful completion, where nbyte is greater than 0, write() shall mark for update the st_ctime and st_mtime fields of the file, and if the file is a regular file, the S_ISUID and S_ISGID bits of the file mode may be cleared. However in chmod description it says: Implementations that use the S_ISUID bit to indicate some other function (for example, mandatory record locking) on non-executable files need not clear this bit on writing. They should clear the bit for executable files and any other cases where the bit grants special powers to processes that change the file contents. Similar comments apply to the S_ISGID bit. > > Dan Strick Nikita.