From patchwork Fri Aug 18 19:49:42 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 110435 Delivered-To: patch@linaro.org Received: by 10.140.95.78 with SMTP id h72csp1343882qge; Fri, 18 Aug 2017 12:50:30 -0700 (PDT) X-Received: by 10.84.169.227 with SMTP id h90mr10706747plb.145.1503085830483; Fri, 18 Aug 2017 12:50:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1503085830; cv=none; d=google.com; s=arc-20160816; b=NdaySjFmMPYm9QZFgAQVgxFPn764gt2cWbwWAfhY1Et4c5QAaxzlyoLnDgyUxx/FBn wHIuWX+jWWtWzKS6hocncxFt1c4ANjf2EnJxPDsXAOMR5QYr5soXicYCFB5fqdtZmVsS cxi+gAlOxxMal+L+fU8KaUyNF6O08/GrJf0vk4+Md+PRbTDUiNcfd1NPH94jUOuyvGjY Evrs+9EqoTRNmOhDiuBvQylvZ1dSzuLYT26Xbg2ieudA22bsvXZvv1f6saYfV080deeA uCcBK6dFi6i9yhObIFSIwMWxODuX/9SkkHDFZzynCieaWik+TsLffHt4KaihFGBVmKVH /wxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=vC3Ol0wcPZLLJ3ZETLARU3ukDSyM+4q2XGXBNcAJ+iI=; b=XOSIidtpyqvKmmHub8vhaTFYXw/GODyImlB6by8AGH2AcdfQCgVe26OriJQ+srezmh ui4aMdAUyfspB4U9qRm2+B4Jy7G9cCY4AUwM+H8mRO//TvwlnXWr/oODrZQelFYKDjhu BrUTQuqnLpjiOn/4emxsco2h8Rq4m28S2yPIa+OaM1hnYuS4nu7C0F5GZMc4LJFT/SPx pjY/qsG9w9wTBgxJs8zdBDY/DCLXuPhueEC7bguLKHkL/MQd4Tm9dqGIfW1Qd8rCBv22 FlnFK634CsfXhC7bTIKQGSm03WSzzSpydrowxs8VrsihY/1gC1D00DV0EzEK6y5WTCKg KNbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=aMytqu3e; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a14si1856751pli.352.2017.08.18.12.50.30; Fri, 18 Aug 2017 12:50:30 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=aMytqu3e; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752457AbdHRTu1 (ORCPT + 26 others); Fri, 18 Aug 2017 15:50:27 -0400 Received: from mail-wm0-f45.google.com ([74.125.82.45]:37293 "EHLO mail-wm0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752320AbdHRTuY (ORCPT ); Fri, 18 Aug 2017 15:50:24 -0400 Received: by mail-wm0-f45.google.com with SMTP id i66so7295705wmg.0 for ; Fri, 18 Aug 2017 12:50:23 -0700 (PDT) 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=vC3Ol0wcPZLLJ3ZETLARU3ukDSyM+4q2XGXBNcAJ+iI=; b=aMytqu3eAPXVYnv11NS3jhy83FySGmw2hV/I7qFiMvb1oZgZwyKqTDv2s0SbO7HIBN Dr9pTlGVI7RTEVZrS3sDDNdeTkp5ZbKzhTHdXGrFmcBurGlyVflypWtDsmX1dL9WPyLU 8F3glYQ2nxLWoigiVLc1DQ2ftqCgz3aSKoCyA= 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=vC3Ol0wcPZLLJ3ZETLARU3ukDSyM+4q2XGXBNcAJ+iI=; b=tmzCC5VLGHxFEukkFBKsxMBN2unfZ2TvCeIKiBGxfC3HJ/rGQdzstWy/cFzgMXH+0a W9Oa7VutTd9FX7dViM8AeVD5ZproS2Rayr2blDsR2ya58CubXGmXh/J8pXRvGx4VUsXH izAz4sXCBVYFk13hbi0NcMypafe8RgtAhdlY3F1uZpFEV3Sx1HSM56tLeoPYED14h/ea NgyXvm71e1JuvPoN7WyI3QNE48FFVaS+Xsd6xMuLqj7/ONSznbDraQae6OpXQcdfihQl 7M818D56pv59FFZOOp1LtXJ5F6n+e3ByPtkULLp6Coeg9QtgUdPbCeXGHDvO4uWN/bbW NcCg== X-Gm-Message-State: AHYfb5iceiQn5lQc46KURBmUzubU54GpRtS5XmI/GLWopHV2v21n+gS5 ZOXfpysWhrZjSQRz X-Received: by 10.28.62.149 with SMTP id l143mr2251295wma.126.1503085823108; Fri, 18 Aug 2017 12:50:23 -0700 (PDT) Received: from localhost.localdomain ([154.146.161.128]) by smtp.gmail.com with ESMTPSA id k29sm5571168wrk.56.2017.08.18.12.50.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 18 Aug 2017 12:50:21 -0700 (PDT) From: Ard Biesheuvel To: linux-efi@vger.kernel.org, Ingo Molnar , Thomas Gleixner , "H . Peter Anvin" Cc: Ard Biesheuvel , linux-kernel@vger.kernel.org, Matt Fleming Subject: [PATCH 09/14] arm: efi: remove pointless dummy .reloc section Date: Fri, 18 Aug 2017 20:49:42 +0100 Message-Id: <20170818194947.19347-10-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170818194947.19347-1-ard.biesheuvel@linaro.org> References: <20170818194947.19347-1-ard.biesheuvel@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The kernel's EFI PE/COFF header contains a dummy .reloc section, and an explanatory comment that claims that this is required for the EFI application loader to accept the Image as a relocatable image (i.e., one that can be loaded at any offset and fixed up in place) This was inherited from the x86 implementation, which has elaborate host tooling to mangle the PE/COFF header post-link time, and which populates the .reloc section with a single dummy base relocation. On ARM, no such tooling exists, and the .reloc section remains empty, and is never even exposed via the BaseRelocationTable directory entry, which is where the PE/COFF loader looks for it. The PE/COFF spec is unclear about relocatable images that do not require any fixups, but the EDK2 implementation, which is the de facto reference for PE/COFF in the UEFI space, clearly does not care, and explicitly mentions (in a comment) that relocatable images with no base relocations are perfectly fine, as long as they don't have the RELOCS_STRIPPED attribute set (which is not the case for our PE/COFF image) So simply remove the .reloc section altogether. Cc: Matt Fleming Signed-off-by: Ard Biesheuvel --- arch/arm/boot/compressed/efi-header.S | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) -- 2.11.0 diff --git a/arch/arm/boot/compressed/efi-header.S b/arch/arm/boot/compressed/efi-header.S index 4169b900d9d4..309d6198d335 100644 --- a/arch/arm/boot/compressed/efi-header.S +++ b/arch/arm/boot/compressed/efi-header.S @@ -41,7 +41,7 @@ pe_header: coff_header: .short 0x01c2 @ ARM or Thumb - .short 2 @ nr_sections + .short 1 @ nr_sections .long 0 @ TimeDateStamp .long 0 @ PointerToSymbolTable .long 0 @ NumberOfSymbols @@ -96,22 +96,6 @@ extra_header_fields: .quad 0 @ BaseRelocationTable section_table: - @ - @ The EFI application loader requires a relocation section - @ because EFI applications must be relocatable. This is a - @ dummy section as far as we are concerned. - @ - .ascii ".reloc\0\0" - .long 0 @ VirtualSize - .long 0 @ VirtualAddress - .long 0 @ SizeOfRawData - .long 0 @ PointerToRawData - .long 0 @ PointerToRelocations - .long 0 @ PointerToLineNumbers - .short 0 @ NumberOfRelocations - .short 0 @ NumberOfLineNumbers - .long 0x42000040 @ Characteristics - .ascii ".text\0\0\0" .long _end - __efi_start @ VirtualSize .long __efi_start @ VirtualAddress