From patchwork Thu Jun 29 08:18:44 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 106615 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp818379qge; Thu, 29 Jun 2017 01:19:09 -0700 (PDT) X-Received: by 10.99.2.69 with SMTP id 66mr14802807pgc.61.1498724349020; Thu, 29 Jun 2017 01:19:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1498724349; cv=none; d=google.com; s=arc-20160816; b=ZHZ4jN8o08cmZBTzH6v3EW/4Pevv4mXroJfrjBNKq/3g4HF77RU4bguULB9FfF21b2 72o6U9+ZF8SMyy4M5eQXD2hliqIQ9h3L2pN4r/3iOAL9gUs7kh1b//AaJUfn/+fDY6bF hUmySa40zwrdgXv/8LIqBuiC/JqjBexdjOzlwSBSVSklPXis3S60iPQdagU3MiSh2huB RQO6d7NUIcuEWHN69la1hVwWiT/HIBpuy/ydP7VGSd3nAGcnliIyvIhTN+wMkprOkc1H 5x6yPVy3w94fGmVExpnebMIYyu94lr3IRCH3QQBrpiJJXRyX0Y8Uo3Y8g8DtB1ekxGLC +Kwg== 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=i0xVy2fGKJza5TOcj8Yzd+/fXYTNpKIBFOCLmhUTA2I=; b=lHtEJg5dZqsRXqnfnrIwAKxk0/lkMWM3XMhN+SKqLLMc2dHwRFeB/lhFpk0yCrJSbT Fr5MsrwGV2tT12O4xYgOkV09l71Buvf85H/99j0sLIbnAAp1ngai5TbiWm6ElsmVIYm7 Z9CKZKuLjJ/it67XOrWqP5yOVO8/90NjH0nSQc+2DlZt5oBsDOT9hp4SETFE8Nf9X1Bp LF/peGzDvWnu/nPPmoIdlx9ziTGobyOtMVzbA88m44ws9izt8PSYo8p0VQFVOKzKMPGE LpfxeSDeD95K8PBDUcPrmYy01iCWdTzHpNHFP8usszg1lIfqOIVF48UEEas7RGxxkE3F oq3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.b=R6rcOTNU; spf=pass (google.com: best guess record for domain of linux-efi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-efi-owner@vger.kernel.org; dmarc=fail (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 h68si3195921pfc.73.2017.06.29.01.19.08; Thu, 29 Jun 2017 01:19:09 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-efi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.b=R6rcOTNU; spf=pass (google.com: best guess record for domain of linux-efi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-efi-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752103AbdF2ITI (ORCPT + 2 others); Thu, 29 Jun 2017 04:19:08 -0400 Received: from mail-wm0-f41.google.com ([74.125.82.41]:33643 "EHLO mail-wm0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752042AbdF2ITG (ORCPT ); Thu, 29 Jun 2017 04:19:06 -0400 Received: by mail-wm0-f41.google.com with SMTP id z75so17102912wmc.0 for ; Thu, 29 Jun 2017 01:19:05 -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=vw11mbpfN5ga0cEoTYR17nlhIVR/QPgl0eTTDTCXqPM=; b=R6rcOTNUZq0yMhbkYsrfLlvgFI413Vr0+VT93YCnEnpr39+T1AdbyB/iM9nVdW3Pru aDejAcq2SUT4Qi0yJuNJ28VuwpE/s8AcCPE/CKfKm8AlgZKWvV+zx9gk6iQBB4pBIHa2 T/H3POzaCTdaYn3Ba2+elnGGMFVB7hmOQPHVQ= 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=vw11mbpfN5ga0cEoTYR17nlhIVR/QPgl0eTTDTCXqPM=; b=UVuJOcHpmkmYuvLZqMLDOdvfU5YFRFCQ9374ZcAu5qheKmbINdwVQ5S/OGom+seOVv tf8fwq2uobrSNsxd9oD9CXCKjTwey/RNnIF0yTc+8mBD10ity4tuv6lqWXedqcSSSL0t TNs7OfZ0olhmMHnvgEykm81KfF9ZJvha+npn4jYT8dAYob8PkwtdU0XpRVqOGa1c4qyI CZC8TqCTAvE4bVh55Kwbv95qeK0akoWlT9GFQEwr+7AsjGwrzl7VzHgJ7WhxzI6Bvmqq H4ozFWnIjeRSr8DfT5ombXe4e9QZ5l2ca7ZH4DGWdWNVzBmqxvEola0IrHEgDQPE5Ja4 f1wQ== X-Gm-Message-State: AKS2vOzPCp1ubtypMNf/FM9RiUj/9BDu7YBOVZkGMpixPKUc2W85kXh7 dVPg/WkIsniUmalxeMrH+Q== X-Received: by 10.28.68.139 with SMTP id r133mr10748460wma.90.1498724344879; Thu, 29 Jun 2017 01:19:04 -0700 (PDT) Received: from localhost.localdomain ([196.90.227.203]) by smtp.gmail.com with ESMTPSA id p34sm5268190wrc.66.2017.06.29.01.19.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 29 Jun 2017 01:19:04 -0700 (PDT) From: Ard Biesheuvel To: linux-efi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux@armlinux.org.uk Cc: matt@codeblueprint.co.uk, leif.lindholm@linaro.org, Ard Biesheuvel Subject: [PATCH v2 2/7] arm: efi: remove pointless dummy .reloc section Date: Thu, 29 Jun 2017 08:18:44 +0000 Message-Id: <20170629081849.15081-3-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170629081849.15081-1-ard.biesheuvel@linaro.org> References: <20170629081849.15081-1-ard.biesheuvel@linaro.org> Sender: linux-efi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-efi@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. Signed-off-by: Ard Biesheuvel --- arch/arm/boot/compressed/efi-header.S | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) -- 2.9.3 -- To unsubscribe from this list: send the line "unsubscribe linux-efi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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