Received: from list by lists.gnu.org with archive (Exim 4.71) id 1gP3vG-00007K-8M for mharc-grub-devel@gnu.org; Tue, 20 Nov 2018 06:10:26 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51789) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gP3vD-0008Vl-KC for grub-devel@gnu.org; Tue, 20 Nov 2018 06:10:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gP3vA-0007pF-H2 for grub-devel@gnu.org; Tue, 20 Nov 2018 06:10:23 -0500 Received: from smtp2.provo.novell.com ([137.65.250.81]:55312) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gP3vA-0007lf-8j for grub-devel@gnu.org; Tue, 20 Nov 2018 06:10:20 -0500 Received: from mazu (prv-ext-foundry1int.gns.novell.com [137.65.251.240]) by smtp2.provo.novell.com with ESMTP (TLS encrypted); Tue, 20 Nov 2018 04:10:15 -0700 Date: Tue, 20 Nov 2018 19:10:11 +0800 From: Michael Chang To: The development of GNU GRUB Subject: Re: [PATCH v2] verifiers: fix double close on pgp's sig file descriptor Message-ID: <20181120111011.GA10363@mazu> Mail-Followup-To: The development of GNU GRUB References: <20181115101311.GA14991@mazu> <20181116140130.bysatoqzek45nnue@tomti.i.net-space.pl> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181116140130.bysatoqzek45nnue@tomti.i.net-space.pl> User-Agent: Mutt/1.10.1 (2018-07-13) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 137.65.250.81 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Nov 2018 11:10:24 -0000 On Fri, Nov 16, 2018 at 03:01:30PM +0100, Daniel Kiper wrote: > On Thu, Nov 15, 2018 at 06:13:11PM +0800, Michael Chang wrote: > > An error emerged as when I was tesing the verifiers branch, so instead > > of putting it in pgp prefix, the verifiers is used to reflect what the > > patch is based on. > > > > While running verify_detached, grub aborts with error. > > > > verify_detached /@/.snapshots/1/snapshot/boot/grub/grub.cfg > > /@/.snapshots/1/snapshot/boot/grub/grub.cfg.sig > > > > alloc magic is broken at 0x7beea660: 0 > > Aborted. Press any key to exit. > > > > The error is caused by sig file desciptor been closed twice, first time > > in grub_verify_signature() to which it is passed as parameter. Second in > > grub_cmd_verify_signature() or in whichever opens the sig file > > decriptor. The second close is not consider as bug to me either, as in > > common rule of what opens a file has to close it to avoid file > > descriptor leakage. > > > > Afterall the design of grub_verify_signature() makes it diffcult to keep > > a good trace on opened file descriptor from it's caller. Let's refine > > the application interface to accept file path rather than descriptor, in > > this way the caller doesn't have to care about closing the descriptor by > > delegating it to grub_verify_signature() with full tracing to opened > > file descriptor by itself. > > > > Signed-off-by: Michael Chang > > Sadly patch does not apply. Could you rebase it on latest master? OK. The conflict is caused by new blank line inserted by new commit which is harmless. > > > v1 -> v2: > > > > - drop change in grub_verify_signature_init() > > If you add a blurb to the commit message why it is needed then I am not > against it. Even to some extent I am happy with it because it makes code > a bit nicer. OK. I'll add that in upcoming v3 patch. :) Thanks, Michael > > Daniel > > _______________________________________________ > Grub-devel mailing list > Grub-devel@gnu.org > https://lists.gnu.org/mailman/listinfo/grub-devel