From patchwork Tue Dec 10 16:01:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilias Apalodimas X-Patchwork-Id: 848793 Delivered-To: patch@linaro.org Received: by 2002:adf:ec08:0:b0:385:e875:8a9e with SMTP id x8csp403150wrn; Tue, 10 Dec 2024 08:02:09 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXyZ1ZymqMVbPVKngNoIqIOp9be9hZr3+O81zDM74638+JDymwhpkWryIjcZ0kTRp3yIAK2Yw==@linaro.org X-Google-Smtp-Source: AGHT+IFD+PaUeb68JyFZGgNyMp4YP78z2UuwDNk/14om63oEk17bOv4RQlM22II11mJUsEgLGddg X-Received: by 2002:a05:6402:11d3:b0:5d0:c9e6:30ba with SMTP id 4fb4d7f45d1cf-5d41e2c6255mr3572358a12.12.1733846528796; Tue, 10 Dec 2024 08:02:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733846528; cv=none; d=google.com; s=arc-20240605; b=fFySHwV6+XIOpQPDYsmETGOJVHG8u0nuSrtdOw7Slsz6txVreK0G2gWL5TD6qNGDgm 0IWuoKQgCJjn3qzo/+YaaHH+x/fG2te43Myz/NRjKf6IhJ6aDZH5BPecOfzmsWmJ7jfz GD3/CmuaaAGsOnsuci0r2DlvFMQh2S//Nz6xNuq0oHxP5f3Ok174gAZMZOUVgKmWNZUA DZWsDZsmmOU4XPtBWVmDuAYPIemHCZHPOI3cyl88bb2p54VOF0tkcsJFnt09e8GGvPKA Y4bfSlvvIixoYFuA1R2ob0XHB3FHPExcF0kMWymtWM88p3CZIM3agF3bK99G2bY4Zv+p hwHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature; bh=XnFJgCMF2ztKHQ2ghXIErNwhvhxM9H8v7nzAPdWGnHo=; fh=ceRRO+HI8Ytf9PcviEz+5yqB8Mouse2WxOegw844hx0=; b=W+8t7TL59zE/w7dh2ZLq/3O6unu1IsRobbXgp+jIzaYAlVGta80SoKfEs2G7T5gyLk vykQhg1oGJs7VYziuQHXXxewJQ46Eyx7+2LCrceFx4usVLmQKLyDYnZNRv2AAlNMw7jb ut7yPyAKrkBi1YY83SUbO2wNM7Xsai60bNJ98b1c0D9LriBoSxZdweyKNeUy5OAF4IMu oZsIylKSgBez8nkJ13BkFVMZyJTQlMMFHVgcWacbq4FQipYZ6BgVQhzhty9aZTfTuyYj mg64urDzyQCyNVBxNn9RtOQweFhd+t7F0j1ZYGfvy7yhAQVjz08cYB2HvE7giydqErpr 3O0g==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=N8srTBCV; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-5d42da58352si310062a12.468.2024.12.10.08.02.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2024 08:02:08 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=N8srTBCV; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id DC77F8020D; Tue, 10 Dec 2024 17:02:06 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="N8srTBCV"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 0A9988020E; Tue, 10 Dec 2024 17:02:05 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ej1-x62c.google.com (mail-ej1-x62c.google.com [IPv6:2a00:1450:4864:20::62c]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 9C5A28020B for ; Tue, 10 Dec 2024 17:02:02 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=ilias.apalodimas@linaro.org Received: by mail-ej1-x62c.google.com with SMTP id a640c23a62f3a-aa692211331so361431166b.1 for ; Tue, 10 Dec 2024 08:02:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733846522; x=1734451322; darn=lists.denx.de; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=XnFJgCMF2ztKHQ2ghXIErNwhvhxM9H8v7nzAPdWGnHo=; b=N8srTBCVQLAYWE1L27Gy+D7dh7VKxFBg1yUYKAtuf4yPUSMMBbQdt3uPOImIrFIJiA W4+lzb9nQm6XXyR2Q33n51Ibah6zU3I9g13LIpzUBiUC55A5vAJRAbyDsQYx5WZYMyUW zPgh/CLqWta+s6VQPqNEC9KRqYkuhbIqAaESKDSyvSsTS+61oMAt5uz77Haux4N2JAXU SAThiqWekahbX2J33pBauKPNmdfUFKCRG49Mb9qDMOdeKWntdKvmdMKPTRZrNiVbL8fT VjvZhrYs0ywtwdCyW6L6PrF8azCyyxbpeOdlJzOgojuEYvEcihTsV1rGYXITaOvWL0Cc JHUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733846522; x=1734451322; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=XnFJgCMF2ztKHQ2ghXIErNwhvhxM9H8v7nzAPdWGnHo=; b=fsHa6Ck1Gn3MdEaD0OgOch16HZ8Hzactcz8lWfNPQ2FX/jk6KpQIF3U7u/15Oj2bih 6wpoIC1E0Ud5teIwyehGEfnlgdGWm/6521AAVvsd5xQdM4NhG/uyX8d9Fhxus1VJeId6 KuzCcS6f0LlZOVru6dJ2rixv2VffTJtUPjocZB15BfC9XqXCuYKskfYCUoLKz8YzGos0 TR6QP3qcuMbNLhaL4OLpxJtsIoIjSJ/6HNrVu3BNWq9Zf2xyBcloM4xkCuNWaktVoEQ8 Nen44yQKv9SJBvTEvUWG029uOoHuwGKaWWa8lwIlCOgtraqVdIJ5P077J28sJk72C7Zk CfGA== X-Forwarded-Encrypted: i=1; AJvYcCW/i53Vm7Zxh/OmdYpqENAAf2FyHcKE/toZSxmXaPywlWVa7T7STCFx2TClY9/J9HNMrJ3nydM=@lists.denx.de X-Gm-Message-State: AOJu0YxFm8C+XBXW070JOwCBT0nHfnQTpH1LTBuCv6hPCiPbv9H4HQhz hpBDiUryl3e3wZ342fzq+IUOwm4BtiOT4oslC9SHn4RYwujC6n8bVOhScHRsgTw= X-Gm-Gg: ASbGncuKy0OCVeGdqt9JRoAQWR7FZIkgB3tBAWlWdW8hnWSzx195q0XClvIjxG/dplP ZO4+zR0Y6OcUQg4mzjumND0F2WtFVPhXobDvioAF+KDaH94c9lLiKx3ryh6nhIlwySGUnxDgtBr hpBZ/yEGA0nvN18DTwV7LwB7wvPAQAb7e/t+xDP9vxBdDeJ2NtV/w+/dqdsfspjL/Lqmkah3mMn RdzV5ahVbPEAPeV9GyjFEFNU8FroPUk5W6FXy3c9whNkKBxALf2oCK70j0QX4GjUhi1vrU7pQF4 TI+8/iNgguaJh1kRC+d7oLISTAggoHc= X-Received: by 2002:a17:907:7156:b0:aa6:88be:729d with SMTP id a640c23a62f3a-aa6a01c50a9mr331273366b.21.1733846521871; Tue, 10 Dec 2024 08:02:01 -0800 (PST) Received: from localhost.localdomain (ppp176092181030.access.hol.gr. [176.92.181.30]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-aa6651c01c5sm534771466b.23.2024.12.10.08.02.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2024 08:02:01 -0800 (PST) From: Ilias Apalodimas To: xypron.glpk@gmx.de, trini@konsulko.com Cc: Ilias Apalodimas , u-boot@lists.denx.de Subject: [PATCH] efi_loader: Fix section alignment on EFI binaries Date: Tue, 10 Dec 2024 18:01:49 +0200 Message-ID: <20241210160150.244773-1-ilias.apalodimas@linaro.org> X-Mailer: git-send-email 2.45.2 MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean When creating EFI binaries, the alignment of the text section isn't correctly factored in. As a result trying to load signed EFI binaries throws an error with: efi_image_region_add() efi_image_region_add: new region already part of another Image not authenticated Running the binary through sbverify has a similar warning sbverify ./lib/efi_loader/helloworld.efi warning: gap in section table: .text : 0x00001000 - 0x00001c00, .data : 0x00002000 - 0x00002200, gaps in the section table may result in different checksums warning: data remaining[7680 vs 12720]: gaps between PE/COFF sections? ..... If we include the alignment in the text section, the signed binary boots fine, and the relevant sbverify warning goes away sbverify ./lib/efi_loader/helloworld.efi warning: data remaining[8704 vs 12720]: gaps between PE/COFF sections? ..... We should look into the remaining warning at some point as well regarding the gaps between PE/COFF sections. Signed-off-by: Ilias Apalodimas --- arch/arm/lib/elf_aarch64_efi.lds | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/lib/elf_aarch64_efi.lds b/arch/arm/lib/elf_aarch64_efi.lds index 5dd98091698c..e382254a6cf5 100644 --- a/arch/arm/lib/elf_aarch64_efi.lds +++ b/arch/arm/lib/elf_aarch64_efi.lds @@ -32,9 +32,9 @@ SECTIONS .rela.plt : { *(.rela.plt) } .rela.got : { *(.rela.got) } .rela.data : { *(.rela.data) *(.rela.data*) } + . = ALIGN(4096); _etext = .; _text_size = . - _text; - . = ALIGN(4096); .data : { _data = .; *(.sdata)