From patchwork Wed Feb 8 11:55:37 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 9562377 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E57F06047A for ; Wed, 8 Feb 2017 11:59:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D7BC5205F6 for ; Wed, 8 Feb 2017 11:59:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CC76F28174; Wed, 8 Feb 2017 11:59:12 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, T_DKIM_INVALID autolearn=no version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6EA90205F6 for ; Wed, 8 Feb 2017 11:59:12 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cbQty-0007h5-KH; Wed, 08 Feb 2017 11:59:10 +0000 Received: from mail-wm0-f51.google.com ([74.125.82.51]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cbQsT-0006TY-GH for linux-arm-kernel@lists.infradead.org; Wed, 08 Feb 2017 11:57:50 +0000 Received: by mail-wm0-f51.google.com with SMTP id r141so184092769wmg.1 for ; Wed, 08 Feb 2017 03:57:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=nYLQ/TWjzdTocZ/APHH9ZMeWcOS9zJzl3JkWnBGDSYg=; b=Fe2JZmfJkyudM3/oXlU67msTnCZSQsZ7suUuD+neHBFc2vbFyFwUfIeb3NgMNSwQht sRX6rGByyD44chFHEVMTFp9vSZTqvBMq5n5rByo85kHFFRSiWMukqc9QBNkJs3DAA6/5 NHSaOcdUwNZb0zO/6R0kWdCxgZlH/aVp2RBq8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=nYLQ/TWjzdTocZ/APHH9ZMeWcOS9zJzl3JkWnBGDSYg=; b=AddLqBW0N6EJpH89io7ixjwYDJK/XAhTitbrPCC5ReLZ2m99g8vrsEl/Ca9vGRlhPV IH5HKKlDN9U612tiQdORiOj+9e6hvG4vEKjl9rWbXmhIc0dhHjsgWWMhzmswwXXWYyLE CGdMccjhIKdb2/0uMtnm7uSqFlPimsGeoQC5eyt/+y0auHzoQNexpsdD30da+i21sA/D qdoJ32Jj/4+dVeOqm8X/1oJ+1i6oue8DG5sje05KXGzGBiF+NAzJC7+O80LF3BwpPS/5 HNnzDqRwsPnrEiEUPtQQer24NQBs/eZGjpwABmKDpf4OfszQseQZIIIqxKC8/vSpQQo6 snSg== X-Gm-Message-State: AMke39mWQL/n8ViZfnsx3ZuyYuL5lNBfbRRT2o9PK1/hO6M30ucNv1SPpoq7kpIzFDK8b1Jw X-Received: by 10.28.191.79 with SMTP id p76mr16806845wmf.21.1486554973357; Wed, 08 Feb 2017 03:56:13 -0800 (PST) Received: from localhost.localdomain ([160.169.163.122]) by smtp.gmail.com with ESMTPSA id 123sm2974815wml.6.2017.02.08.03.56.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 08 Feb 2017 03:56:12 -0800 (PST) From: Ard Biesheuvel To: linux-efi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, mark.rutland@arm.com, leif.lindholm@linaro.org Subject: [PATCH v2 04/14] arm64: efi: clean up Image header after PE header has been split off Date: Wed, 8 Feb 2017 11:55:37 +0000 Message-Id: <1486554947-3964-5-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1486554947-3964-1-git-send-email-ard.biesheuvel@linaro.org> References: <1486554947-3964-1-git-send-email-ard.biesheuvel@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170208_035738_172816_FB90A699 X-CRM114-Status: GOOD ( 10.95 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ard Biesheuvel , catalin.marinas@arm.com, labbott@fedoraproject.org, linux@armlinux.org.uk, kernel-hardening@lists.openwall.com MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP After having split off the PE header, clean up the bits that remain: use .long consistently, merge two adjacent #ifdef CONFIG_EFI blocks, fix the offset of the PE header pointer and remove the redundant .align that follows it. Also, since we will be eliminating all open coded constants from the EFI header in subsequent patches, let's replace the open coded "ARM\x64" magic number with its .ascii equivalent. No changes to the resulting binary image are intended. Signed-off-by: Ard Biesheuvel --- arch/arm64/kernel/head.S | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/arch/arm64/kernel/head.S b/arch/arm64/kernel/head.S index f779a7483736..aa8f6cd8c33f 100644 --- a/arch/arm64/kernel/head.S +++ b/arch/arm64/kernel/head.S @@ -91,20 +91,19 @@ _head: .quad 0 // reserved .quad 0 // reserved .quad 0 // reserved - .byte 0x41 // Magic number, "ARM\x64" - .byte 0x52 - .byte 0x4d - .byte 0x64 + .ascii "ARM\x64" // Magic number #ifdef CONFIG_EFI + /* + * PE/COFF requires the offset to the PE header + * to be stored at offset 0x3c into the file. + */ + .org _head + 0x3c .long pe_header - _head // Offset to the PE header. -#else - .word 0 // reserved -#endif -#ifdef CONFIG_EFI - .align 3 pe_header: __EFI_PE_HEADER +#else + .long 0 // reserved #endif __INIT