From patchwork Fri Jul 15 08:40:20 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 72073 Delivered-To: patch@linaro.org Received: by 10.140.29.52 with SMTP id a49csp497859qga; Fri, 15 Jul 2016 01:40:24 -0700 (PDT) X-Received: by 10.66.244.199 with SMTP id xi7mr29441188pac.127.1468572024685; Fri, 15 Jul 2016 01:40:24 -0700 (PDT) Return-Path: Received: from ml01.01.org (ml01.01.org. [198.145.21.10]) by mx.google.com with ESMTPS id vw8si8021496pab.230.2016.07.15.01.40.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 15 Jul 2016 01:40:24 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) client-ip=198.145.21.10; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id DA2F71A1F04; Fri, 15 Jul 2016 01:41:10 -0700 (PDT) X-Original-To: edk2-devel@ml01.01.org Delivered-To: edk2-devel@ml01.01.org Received: from mail-io0-x236.google.com (mail-io0-x236.google.com [IPv6:2607:f8b0:4001:c06::236]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id C63051A1EC9 for ; Fri, 15 Jul 2016 01:41:08 -0700 (PDT) Received: by mail-io0-x236.google.com with SMTP id q83so98703283iod.1 for ; Fri, 15 Jul 2016 01:40:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=GHbqv99Z4ztcvU0L+epE87EpwZJc8G+y4cigXZWpk+U=; b=O79mRZXI6it7ORrgM2lW19GtpOkxs8RR3x7iZkpNUvAC25+vsrnHTzva4dn8REqC2A T+LoN4X4ouMUhMl2Fvag005sauLxqusio0PextPI4a/odZqhDbl+p0JDxF/HEEc0B904 ipH7zHpnjuVuI3Q53qNEapwuayKIXzZ625/Cg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=GHbqv99Z4ztcvU0L+epE87EpwZJc8G+y4cigXZWpk+U=; b=lQtfitZ/O0OFS45n89NqRKEWBJq9u4KWxcqjFCgjJuLdwVbSquavuqZzrHc1bUBz2K uHTDEWoBwuIYvkNh0HGJGiDieuW0zEAbTwyR6EQl7K42bMwAMKyGI2PiwJRNGCPllG+/ i1+mzsgLBscsQYW8mIB8tYDN9Z2WjvfqkkUWzrU0aAkta0qfYvXtsWsMIlmdRuf3MXQv OKvKoSbUwE9nQhXkBDu8KkNY4Khl/rsD6aJz078AI6rOzf+haU1zAeWUw//CjfMqPJze x7rIe6ROLF5+XZA7Paxwi6tornJ+zOZDorrp631s0ybt+QeVTtQGSXLf5N5h7XPhlKLT PLMA== X-Gm-Message-State: ALyK8tKI1WKm3p8kwuHuR5TuLvWHeYC9R/y5Wmk17t/P6Xar7T39jhLaShRSuWxqQH6RngoYW6Q0CVGv3rnV3ZaW X-Received: by 10.107.135.22 with SMTP id j22mr19082544iod.56.1468572021088; Fri, 15 Jul 2016 01:40:21 -0700 (PDT) MIME-Version: 1.0 Received: by 10.36.214.6 with HTTP; Fri, 15 Jul 2016 01:40:20 -0700 (PDT) In-Reply-To: <9f7f411c-6cce-48bb-af57-87c9ce2eef64@redhat.com> References: <1468502169-15248-1-git-send-email-ard.biesheuvel@linaro.org> <9f7f411c-6cce-48bb-af57-87c9ce2eef64@redhat.com> From: Ard Biesheuvel Date: Fri, 15 Jul 2016 10:40:20 +0200 Message-ID: To: Laszlo Ersek Subject: Re: [edk2] [PATCH 0/5] MdePkg BaseTools: GCC optimization for X64 X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Jordan Justen , "edk2-devel@lists.01.org" , "afish@apple.com" , "Gao, Liming" , "Kinney, Michael D" Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" On 15 July 2016 at 08:33, Laszlo Ersek wrote: > On 07/15/16 08:07, Ard Biesheuvel wrote: >> On 15 July 2016 at 01:27, Laszlo Ersek wrote: > >>> First, the build tests. I built OVMF 84 times, with the following settings: >>> >>> * Dimension 1: whether your and Steven's patches were applied or not. >> >> I take it this means this series only? > > Ah, yes, sorry about the ambiguity -- with "your and Steven's patches" I > meant the five patches in this series -- one patch from Steven, four > patches from you. > >>> * However, then I built my program -- find it attached -- with -b DEBUG >>> and -b RELEASE too, and the -b RELEASE binary is broken. Here's the >>> difference in output: >>> >>> FS2:\> DebugEnrollDefaultKeys.efi >>> info: SetupMode=1 SecureBoot=0 SecureBootEnable=1 CustomMode=1 VendorKeys=0 >>> info: SetupMode=0 SecureBoot=1 SecureBootEnable=1 CustomMode=0 VendorKeys=0 >>> info: success >>> >>> versus >>> >>> FS2:\> OptEnrollDefaultKeys.efi >>> info: SetupMode=1 SecureBoot=0 SecureBootEnable=1 CustomMode=1 VendorKeys=0 >>> error: EnrollListOfX509Certs("db", >>> D719B2CB-3D3A-4596-A3BC-DAD00E67656F): Invalid Parameter >>> >>> I don't know why this happens, but it definitely relates to varargs -- >>> the program uses them liberally. >>> >> >> If this code ultimately uses __builtin_ms_va_lists with -O2 and fails, >> it makes sense to report it to the GCC maintainers (assuming we can >> create a test case). I noticed that this code iterates over the same >> VA_LIST twice, I wonder how well that was tested ... > > You make a good point about using VA_LIST twice possibly tickling gcc > the wrong way. Plus, there's one (VOID)VA_ARG() macro invocation in my > code -- in order to step over some arguments --, which might not be all > that usual as well. > > In any case, the way I use varargs seems to be standards conformant. > > With regard to reporting this to gcc developers: I won't try that. I'm > discouraged by two facts: > > * https://gcc.gnu.org/bugzilla/show_bug.cgi?id=50818 -- open since > October 2011. You'll find some recent comments from Steven and David in > it :) > > * http://thread.gmane.org/gmane.comp.bios.tianocore.devel/10963 -- > shortly after I ran into the -Os corruption issue with GCC48, I created > and posted this small reproducer. Creating the reproducer wasn't > trivial. In parallel I sent the same reproducer to one of my (indirect) > colleagues at Red Hat, who had been a veteran in upstream GCC > development and maintenance. I also asked him how/where I should report > the bug. I got no answer from him. > > If you'd like to report a GCC bug, please go ahead, but I won't waste my > time :) > It seems that it is your testcase that is broken: With that change, everything works fine for me Thanks, Ard. _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel Tested-by: Laszlo Ersek --- a/OvmfPkg/EnrollDefaultKeys/EnrollDefaultKeys.c +++ b/OvmfPkg/EnrollDefaultKeys/EnrollDefaultKeys.c @@ -663,6 +663,8 @@ EnrollListOfX509Certs ( UINT8 *Data; UINT8 *Position; + Status = EFI_SUCCESS; + // // compute total size first, for UINT32 range check, and allocation //