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: 9562347 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 69BBB6047A for ; Wed, 8 Feb 2017 11:56:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5C627284C9 for ; Wed, 8 Feb 2017 11:56:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 510B5284CF; Wed, 8 Feb 2017 11:56:41 +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=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from mother.openwall.net (mother.openwall.net [195.42.179.200]) by mail.wl.linuxfoundation.org (Postfix) with SMTP id 6855C284C9 for ; Wed, 8 Feb 2017 11:56:40 +0000 (UTC) Received: (qmail 9460 invoked by uid 550); 8 Feb 2017 11:56:27 -0000 Mailing-List: contact kernel-hardening-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Delivered-To: mailing list kernel-hardening@lists.openwall.com Received: (qmail 8152 invoked from network); 8 Feb 2017 11:56:24 -0000 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=Mv6MxuEQ5Pu+SRp3e6Pmp6Y8/NRD2GIn1imfexD6axseATOUikaJvwz3VTxbbfv7mI 0/DzHtj67JlTxkzW+DGTXW716OkxVBjmUDr+zFsfDNmaCIMKzD7ZZPirUsMXQPlOviKF rU7v9fRHaI/AjOcbWyEh6T5om6dFIqd+mu92K7PjCddY1T1WRYuU6lDIlln+TlgGLknw 2RQW4zdsbuc5msXsz3fhxt0SPJIg2NK+SaMd4Jo+cfk/C1l/hQg5Lno4evyQvch8Iq+3 BP8WeRvj9/DMfvKvJeDLNP/G8j3I5nMuCf3f07Rfvjkbr1bv9BUaQkc2v4yQuFYrEPAU XH9Q== X-Gm-Message-State: AMke39kUBrru4EzFrPZ1BlfnfnYNAd3z4yAcWcRCD1jbUFBTRnRPrh1E0qb96KmBFDzQHmI+ X-Received: by 10.28.191.79 with SMTP id p76mr16806845wmf.21.1486554973357; Wed, 08 Feb 2017 03:56:13 -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 Cc: catalin.marinas@arm.com, linux@armlinux.org.uk, kernel-hardening@lists.openwall.com, labbott@fedoraproject.org, Ard Biesheuvel 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> Subject: [kernel-hardening] [PATCH v2 04/14] arm64: efi: clean up Image header after PE header has been split off 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