From patchwork Mon Jun 29 18:10:22 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 50439 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f197.google.com (mail-wi0-f197.google.com [209.85.212.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id C3EBE218E4 for ; Mon, 29 Jun 2015 18:10:46 +0000 (UTC) Received: by wibdu3 with SMTP id du3sf10871398wib.2 for ; Mon, 29 Jun 2015 11:10:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:mime-version:in-reply-to:references :date:message-id:from:to:cc:subject:precedence:reply-to:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :content-type:content-transfer-encoding:errors-to:x-original-sender :x-original-authentication-results:mailing-list; bh=c8OBPmQLXJa2XlaKxQPXIYv2xJMbskWcFvpgiSXe0UA=; b=c10uqTXb1WY2cYVVwkahN7lb5jwsbqE85zRFnxaIWwXGNnCXek/1UVSThd7Ou7ntJz TB5CabViJoZ9CzndWUuGi1QYR0gPQdYgxRFBHzeY1ddfGNBVC9K+4xoTiCIy7IKlIS5M fYcOG7tv4tnwzzyVGiOAYUsqZvgXlEvgQD2mFvM84pOeTDxx4hvZf/rl9jy/XHHQaqNm CkRM3uX2GN7ugqvCW87DyrqAlpahOWmAjhnnqetSP3RJa6Hhb5bIF44kILBJ23PY4WgD aTEdWLqI84bxavymZ4KzrgYm9WMjBFhftedgNrhibYiUEx15rHEDwfs4HS1PElM0/cDk Q3Gg== X-Gm-Message-State: ALoCoQn3hMo4foGVq0LYuCVud2kf48kRw5lvVNlHHUrz4fZ8u9TkvrXr3DLHg1ERhpB1+74Yy4IU X-Received: by 10.112.162.228 with SMTP id yd4mr11540441lbb.8.1435601446006; Mon, 29 Jun 2015 11:10:46 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.37.69 with SMTP id w5ls820256laj.107.gmail; Mon, 29 Jun 2015 11:10:45 -0700 (PDT) X-Received: by 10.152.29.234 with SMTP id n10mr15487697lah.101.1435601445853; Mon, 29 Jun 2015 11:10:45 -0700 (PDT) Received: from mail-la0-f43.google.com (mail-la0-f43.google.com. [209.85.215.43]) by mx.google.com with ESMTPS id m18si11571165lbg.157.2015.06.29.11.10.45 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 29 Jun 2015 11:10:45 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.43 as permitted sender) client-ip=209.85.215.43; Received: by laar3 with SMTP id r3so73450517laa.0 for ; Mon, 29 Jun 2015 11:10:45 -0700 (PDT) X-Received: by 10.112.126.101 with SMTP id mx5mr15724890lbb.35.1435601445345; Mon, 29 Jun 2015 11:10:45 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.108.230 with SMTP id hn6csp1878054lbb; Mon, 29 Jun 2015 11:10:43 -0700 (PDT) X-Received: by 10.42.176.8 with SMTP id bc8mr19379497icb.22.1435601443358; Mon, 29 Jun 2015 11:10:43 -0700 (PDT) Received: from lists.sourceforge.net (lists.sourceforge.net. [216.34.181.88]) by mx.google.com with ESMTPS id h2si6849794igv.51.2015.06.29.11.10.42 (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 29 Jun 2015 11:10:43 -0700 (PDT) Received-SPF: pass (google.com: domain of edk2-devel-bounces@lists.sourceforge.net designates 216.34.181.88 as permitted sender) client-ip=216.34.181.88; Received: from localhost ([127.0.0.1] helo=sfs-ml-1.v29.ch3.sourceforge.com) by sfs-ml-1.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1Z9dVm-0001ai-2V; Mon, 29 Jun 2015 18:10:30 +0000 Received: from sog-mx-2.v43.ch3.sourceforge.com ([172.29.43.192] helo=mx.sourceforge.net) by sfs-ml-1.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1Z9dVk-0001ac-Mz for edk2-devel@lists.sourceforge.net; Mon, 29 Jun 2015 18:10:28 +0000 Received-SPF: pass (sog-mx-2.v43.ch3.sourceforge.com: domain of linaro.org designates 209.85.223.174 as permitted sender) client-ip=209.85.223.174; envelope-from=ard.biesheuvel@linaro.org; helo=mail-ie0-f174.google.com; Received: from mail-ie0-f174.google.com ([209.85.223.174]) by sog-mx-2.v43.ch3.sourceforge.com with esmtps (TLSv1:RC4-SHA:128) (Exim 4.76) id 1Z9dVj-0004If-Kz for edk2-devel@lists.sourceforge.net; Mon, 29 Jun 2015 18:10:28 +0000 Received: by iecuq6 with SMTP id uq6so21344020iec.2 for ; Mon, 29 Jun 2015 11:10:22 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.43.97.69 with SMTP id cj5mr18470418icc.75.1435601422283; Mon, 29 Jun 2015 11:10:22 -0700 (PDT) Received: by 10.36.138.69 with HTTP; Mon, 29 Jun 2015 11:10:22 -0700 (PDT) In-Reply-To: References: <74D8A39837DF1E4DA445A8C0B3885C50013408B8@shsmsx102.ccr.corp.intel.com> <559142D8.5090900@redhat.com> <20150629150952.GG28334@codeblueprint.co.uk> Date: Mon, 29 Jun 2015 20:10:22 +0200 Message-ID: From: Ard Biesheuvel To: Matt Fleming X-Spam-Score: -1.5 (-) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -1.5 SPF_CHECK_PASS SPF reports sender host as permitted sender for sender-domain -0.0 SPF_PASS SPF: sender matches SPF record X-Headers-End: 1Z9dVj-0004If-Kz Cc: "edk2-devel@lists.sourceforge.net" , Matt Fleming Subject: Re: [edk2] BUG in properties table feature implementation X-BeenThere: edk2-devel@lists.sourceforge.net X-Mailman-Version: 2.1.9 Precedence: list Reply-To: edk2-devel@lists.sourceforge.net List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Errors-To: edk2-devel-bounces@lists.sourceforge.net X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ard.biesheuvel@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.43 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 On 29 June 2015 at 17:12, Ard Biesheuvel wrote: > On 29 June 2015 at 17:09, Matt Fleming wrote: >> On Mon, 29 Jun, at 03:06:32PM, Laszlo Ersek wrote: >>> >>> In any case, for OVMF, I think we'll need a small patch that disables >>> this feature (if for nothing else, then to quell the noisy warnings >>> about "the section alignment being != 4 KB"). I'm adding that to my >>> queue (but anyone please feel free to do it while I'm offline). >> >> Is there any chance that we could wire up support in OVMF? What work is >> required to support it? >> > > I think it would be fairly easy, actually, once Laszlo manages to > untangle the S3Save mess so that OVMF signals EndOfDxe correctly. > Then, it is mainly a matter of using the new build script that emits 4 > KB aligned segments for .text and .data > This seems to do the job nicely: ----------8<------------ ----------8<------------ $ readelf -S Build/OvmfX64/DEBUG_GCC48/X64/OvmfPkg/EmuVariableFvbRuntimeDxe/Fvb/DEBUG/EmuVariableFvbRuntimeDxe.dll Section Headers: [Nr] Name Type Address Offset Size EntSize Flags Link Info Align ... [ 1] .text PROGBITS 0000000000001000 00001000 0000000000004780 0000000000000000 AX 0 0 4096 ... [ 3] .data PROGBITS 0000000000006000 00006000 0000000000002740 0000000000000000 WA 0 0 4096 ... With Laszlo's 9 piece series applied to ensure that end of DXE gets signalled, UEFI seems to do the right thing here. Here's a snippet of my boot log (x86_64) [ 0.000000] efi: mem22: type=6, attr=0x800000000000400f, range=[0x0000000006daa000-0x0000000006db1000) (0MB) [ 0.000000] efi: mem23: type=5, attr=0x800000000002000f, range=[0x0000000006db1000-0x0000000006db6000) (0MB) [ 0.000000] efi: mem24: type=6, attr=0x800000000000400f, range=[0x0000000006db6000-0x0000000006dc0000) (0MB) [ 0.000000] efi: mem25: type=6, attr=0x800000000000400f, range=[0x0000000006dc0000-0x0000000006dc1000) (0MB) [ 0.000000] efi: mem26: type=5, attr=0x800000000002000f, range=[0x0000000006dc1000-0x0000000006dc5000) (0MB) [ 0.000000] efi: mem27: type=6, attr=0x800000000000400f, range=[0x0000000006dc5000-0x0000000006dce000) (0MB) [ 0.000000] efi: mem28: type=6, attr=0x800000000000400f, range=[0x0000000006dce000-0x0000000006dcf000) (0MB) [ 0.000000] efi: mem29: type=5, attr=0x800000000002000f, range=[0x0000000006dcf000-0x0000000006dd5000) (0MB) [ 0.000000] efi: mem30: type=6, attr=0x800000000000400f, range=[0x0000000006dd5000-0x0000000006e02000) (0MB) [ 0.000000] efi: mem31: type=6, attr=0x800000000000400f, range=[0x0000000006e02000-0x0000000006e03000) (0MB) [ 0.000000] efi: mem32: type=5, attr=0x800000000002000f, range=[0x0000000006e03000-0x0000000006e12000) (0MB) [ 0.000000] efi: mem33: type=6, attr=0x800000000000400f, range=[0x0000000006e12000-0x0000000006e1a000) (0MB) so code and data regions are correctly marked as RO and XP, respectively. However, further down I get [ 0.034428] BUG: unable to handle kernel paging request at fffffffefe60d64d [ 0.036000] IP: [] 0xfffffffefe60d64d [ 0.036000] PGD 4c11067 PUD 601b063 PMD 6028063 PTE 0 [ 0.036000] Oops: 0010 [#1] SMP [ 0.036000] Modules linked in: [ 0.036000] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 3.13.0-55-generic #94-Ubuntu [ 0.036000] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 0.0.0 02/06/2015 [ 0.036000] task: ffffffff81c15480 ti: ffffffff81c00000 task.ti: ffffffff81c00000 [ 0.036000] RIP: 0010:[] [] 0xfffffffefe60d64d [ 0.036000] RSP: 0000:ffffffff81c01d48 EFLAGS: 00000202 [ 0.036000] RAX: fffffffefe60d64d RBX: ffffffffffffffff RCX: ffffffff81c396e0 [ 0.036000] RDX: ffffffff81c01f00 RSI: ffffffff81c396e0 RDI: fffffffefe40a957 [ 0.036000] RBP: ffffffff81c01e00 R08: 0000000000000007 R09: 0000000000000000 [ 0.036000] R10: ffffea0000180e00 R11: ffffffff81d51ce0 R12: ffffffff81c01f00 [ 0.036000] R13: 0000000000000000 R14: 0000000000000007 R15: 000000000009c000 [ 0.036000] FS: 0000000000000000(0000) GS:ffff880006600000(0000) knlGS:0000000000000000 [ 0.036000] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 0.036000] CR2: fffffffefe60d64d CR3: 000000000009c000 CR4: 00000000000006b0 [ 0.036000] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 0.036000] DR3: 0000000000000000 DR6: 0000000000000000 DR7: 0000000000000000 [ 0.036000] Stack: [ 0.036000] fffffffefe40aa08 ffffffff81c01da0 0000000007eb3893 0000000006db7000 [ 0.036000] 0000000006db7000 0000000006dba000 0000000007eed090 0000000000000078 [ 0.036000] 752ea16d07eede98 ffffffff81c01de0 0000000007eb3800 0000000007eed018 [ 0.036000] Call Trace: [ 0.036000] [] efi_call5+0x71/0xf0 [ 0.036000] [] ? virt_efi_set_variable+0x49/0x60 [ 0.036000] [] efi_enter_virtual_mode+0x2fe/0x332 [ 0.036000] [] start_kernel+0x3a4/0x443 [ 0.036000] [] ? repair_env_string+0x5c/0x5c [ 0.036000] [] ? early_idt_handlers+0x120/0x120 [ 0.036000] [] x86_64_start_reservations+0x2a/0x2c [ 0.036000] [] x86_64_start_kernel+0x143/0x152 [ 0.036000] Code: Bad RIP value. [ 0.036000] RIP [] 0xfffffffefe60d64d [ 0.036000] RSP [ 0.036000] CR2: fffffffefe60d64d [ 0.036000] ---[ end trace acf85ef8d4475d7c ]--- diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc index e5fc90d2e610..7f06b51f65cf 100644 --- a/OvmfPkg/OvmfPkgX64.dsc +++ b/OvmfPkg/OvmfPkgX64.dsc @@ -48,6 +48,9 @@ [BuildOptions] INTEL:*_*_X64_GENFW_FLAGS = --keepexceptiontable !endif +[BuildOptions.X64.EDKII.DXE_RUNTIME_DRIVER] + GCC:*_*_*_DLINK_FLAGS = --script=$(EDK_TOOLS_PATH)/Scripts/gcc-4K-align-ld-script + ################################################################################ # # SKU Identification section - list of all SKU IDs supported by this Platform.