From owner-freebsd-hackers@FreeBSD.ORG Fri Oct 31 15:51:20 2008 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 53C0B1065674 for ; Fri, 31 Oct 2008 15:51:20 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from mx1.stack.nl (meestal-mk5.stack.nl [IPv6:2001:610:1108:5010::149]) by mx1.freebsd.org (Postfix) with ESMTP id 081348FC25 for ; Fri, 31 Oct 2008 15:51:20 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from snail.stack.nl (snail.stack.nl [IPv6:2001:610:1108:5010::131]) by mx1.stack.nl (Postfix) with ESMTP id 183BE3F696 for ; Fri, 31 Oct 2008 16:51:18 +0100 (CET) Received: by snail.stack.nl (Postfix, from userid 1677) id 0619822899; Fri, 31 Oct 2008 16:51:17 +0100 (CET) Date: Fri, 31 Oct 2008 16:51:17 +0100 From: Jilles Tjoelker To: freebsd-hackers@freebsd.org Message-ID: <20081031155117.GA55445@stack.nl> References: <20081030154711.GA8416@icarus.home.lan> <490A6A8A.7080504@delphij.net> <20081031024748.GA20319@icarus.home.lan> <20081031134842.GA15218@psconsult.nl> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20081031134842.GA15218@psconsult.nl> X-Operating-System: FreeBSD 7.1-PRERELEASE i386 User-Agent: Mutt/1.5.18 (2008-05-17) Subject: Re: open(2) and O_NOATIME X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Oct 2008 15:51:20 -0000 On Fri, Oct 31, 2008 at 02:48:42PM +0100, Paul Schenkeveld wrote: > utimes(2) allows non-root users to (re)set atime provided they own the > file or have write permission. Having O_NOATIME follow the same rules > would not break any assumed security any further than utimes(2) already > does but greatfully benefit all kind of backup programs. This is not entirely correct. utimes(2) with NULL timestamps (reset atime and mtime to current time) is allowed to root, owner or with write permission, but utimes(2) with given timestamps is only allowed to root and owner. O_NOATIME seems equivalent to the latter, and in fact this is the case in Linux (if someone else than root or the owner tries to open a file with O_NOATIME, they get EPERM). There's only a small detail missing: any utimes(2) call updates the ctime, so you can see "something" happened to the file. Linux's O_NOATIME does not update any times at all (this speeds up things). Anyway, O_NOATIME (only for root/owner) seems a useful feature. -- Jilles Tjoelker