Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1MtdtK-0006Z5-6V for mharc-grub-devel@gnu.org; Fri, 02 Oct 2009 04:53:30 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MtdtH-0006XV-GG for grub-devel@gnu.org; Fri, 02 Oct 2009 04:53:27 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MtdtC-0006Tl-Hu for grub-devel@gnu.org; Fri, 02 Oct 2009 04:53:26 -0400 Received: from [199.232.76.173] (port=39428 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MtdtB-0006TX-V4 for grub-devel@gnu.org; Fri, 02 Oct 2009 04:53:22 -0400 Received: from smarthost02.mail.zen.net.uk ([212.23.3.141]:39557) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MtdtB-0005eY-HX for grub-devel@gnu.org; Fri, 02 Oct 2009 04:53:21 -0400 Received: from [82.69.40.219] (helo=riva.pelham.vpn.ucam.org) by smarthost02.mail.zen.net.uk with esmtp (Exim 4.63) (envelope-from ) id 1Mtdt9-0003pq-J2 for grub-devel@gnu.org; Fri, 02 Oct 2009 08:53:19 +0000 Received: from cjwatson by riva.pelham.vpn.ucam.org with local (Exim 3.36 #1 (Debian)) for grub-devel@gnu.org id 1Mtdt7-0001H7-00; Fri, 02 Oct 2009 09:53:17 +0100 Date: Fri, 2 Oct 2009 09:53:16 +0100 From: Colin Watson To: The development of GRUB 2 Message-ID: <20091002085314.GD13423@riva.ucam.org> References: <20090930225430.GX13423@riva.ucam.org> <2e59e6970910011931r6e8051a3qd74a316111603e8e@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2e59e6970910011931r6e8051a3qd74a316111603e8e@mail.gmail.com> User-Agent: Mutt/1.5.18 (2008-05-17) X-Originating-Smarthost02-IP: [82.69.40.219] X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) Subject: Re: [PATCH] Create environment block safely X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Oct 2009 08:53:27 -0000 On Thu, Oct 01, 2009 at 09:31:55PM -0500, richardvoigt@gmail.com wrote: > On Wed, Sep 30, 2009 at 5:54 PM, Colin Watson wrote: > > If grub-editenv create is interrupted, it's theoretically possible for > > it to create an incomplete block that future grub-editenv calls won't > > recognise. It would be better for it to atomically create either a > > complete block or nothing. Any objections? > > Be aware that this may lose security settings. Write-in-place is also > different wrt hard links, but it would be pretty odd for that file to > have additional hard links. While this would be true for writing files in general, this is explicitly a "create" operation and so I don't think that matters. We use different code paths when writing to an existing environment block file. > You might also need to check for the alternate name, in case the > operation failed after writing the new content and unlinking the old > file, but before renaming the new file. There is no old file here, or if there is then the user has already explicitly indicated that they don't care about it. There is no unlink call in my code (and wouldn't be even if this weren't a create operation; no need to bother when you're renaming over the top anyway). -- Colin Watson [cjwatson@ubuntu.com]