From patchwork Mon Jan 14 15:27:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Graf X-Patchwork-Id: 155542 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp3795986jaa; Mon, 14 Jan 2019 07:40:51 -0800 (PST) X-Google-Smtp-Source: ALg8bN5zns+uTrZxyPLg66ksnjd2IK0Wg+i4e81G/3JtaddbEDKFuik5D3zpzb9POe5GTHBygGip X-Received: by 2002:adf:f1cb:: with SMTP id z11mr24467032wro.35.1547480451873; Mon, 14 Jan 2019 07:40:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547480451; cv=none; d=google.com; s=arc-20160816; b=FVyGNb27poa+WTMLjGnZSwZ4kkbEhVmIK1+JqwYgRA6oWlHUddoVNh+4ut2b2UYg+d 88bHv5BlNWbNuhYcDuP9B1Nn/465eqnW3FvImh7xc+KbReqqg4tUBe8dgNTu+1avSzW+ BPROth7GAICGPjlwCFMNX108zkLHn89ZF/lnjl/xDp5uzGIcxWekZ6ZE8o2/CgFTkVmb Yyo+mXPtjVFrhqkp5i+TV0GOQQ99pnSMeO+s1l2MGrJIm/01uC4O8TblMpGg5iozeKy0 BsZR1ZX+dXSvQM1N8KK5oY2AutzUKZHLfEMXvC/qEwtsO6+49Pv2D+zm1s9qaWfWLjkj UhCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:references:in-reply-to:message-id:date:subject :to:from; bh=Pgk1y8BdXjaVGAlbJ0ZhLRo+hzUBYVM9yLEG68HcaTA=; b=li7Puz0+HRlYYKxDwZH4JidgULzSdHEY5YN1IXOne5r+FmazJCCCklao97AF4rU8sM 7101eKk1IXmqDGwwCdanGUhAjhFb0JfsmbrDkuzrLITcU962/zIgHxClSD9InL+uL3dv o3nKgq+NjVEDEdFjgBM582QLUyYwewsEt516oj3kurhM9iAHdxhlVj3vZGfhHIBg8TAQ H1yLaQTaZC/zR3BjNwsme39WpE9SSBxZ7djJgumqOl7FAL6IkqgmdMEzPVMJC6+sFgaZ q3gHIWJ8PBdgAZ5uWKLQrRFWVHyVVaGtaaGmGmfHpwAXpTcp50h5YK6eKQPb5pdT39Wh SqeQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of grub-devel-bounces+patch=linaro.org@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="grub-devel-bounces+patch=linaro.org@gnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id z16si18452735wmc.53.2019.01.14.07.40.51 for (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 14 Jan 2019 07:40:51 -0800 (PST) Received-SPF: pass (google.com: domain of grub-devel-bounces+patch=linaro.org@gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of grub-devel-bounces+patch=linaro.org@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="grub-devel-bounces+patch=linaro.org@gnu.org" Received: from localhost ([127.0.0.1]:56431 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gj4M6-000733-TX for patch@linaro.org; Mon, 14 Jan 2019 10:40:50 -0500 Received: from eggs.gnu.org ([209.51.188.92]:41448) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gj495-0003MI-Lf for grub-devel@gnu.org; Mon, 14 Jan 2019 10:27:27 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gj492-000893-5K for grub-devel@gnu.org; Mon, 14 Jan 2019 10:27:21 -0500 Received: from mx2.suse.de ([195.135.220.15]:36414 helo=mx1.suse.de) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gj491-00088g-Tr for grub-devel@gnu.org; Mon, 14 Jan 2019 10:27:20 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id D25A5AF92; Mon, 14 Jan 2019 15:27:18 +0000 (UTC) From: Alexander Graf To: grub-devel@gnu.org Subject: [PATCH v3 1/4] mkimage: Simplify header size logic Date: Mon, 14 Jan 2019 16:27:15 +0100 Message-Id: <20190114152718.60629-2-agraf@suse.de> X-Mailer: git-send-email 2.12.3 In-Reply-To: <20190114152718.60629-1-agraf@suse.de> References: <20190114152718.60629-1-agraf@suse.de> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] X-Received-From: 195.135.220.15 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: The development of GNU GRUB Cc: Jon Masters , Daniel Kiper , Leif Lindholm , Ard Biesheuvel MIME-Version: 1.0 Errors-To: grub-devel-bounces+patch=linaro.org@gnu.org Sender: "Grub-devel" For EFI images, we always have the following layout: [PE header] [padding] [first section (which also is the entry point)] Currently there are 2 places where we define how big header+padding are: in the .vaddr_offset member of our target image definition struct as well as in code in grub_install_generate_image(). Remove the latter, so that we only have a single place to modify if we need to change the padding. Signed-off-by: Alexander Graf Reviewed-by: Daniel Kiper --- util/mkimage.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) -- 2.12.3 _______________________________________________ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel diff --git a/util/mkimage.c b/util/mkimage.c index 353bb1098..88b991764 100644 --- a/util/mkimage.c +++ b/util/mkimage.c @@ -1226,10 +1226,7 @@ grub_install_generate_image (const char *dir, const char *prefix, int header_size; int reloc_addr; - if (image_target->voidp_sizeof == 4) - header_size = EFI32_HEADER_SIZE; - else - header_size = EFI64_HEADER_SIZE; + header_size = image_target->vaddr_offset; reloc_addr = ALIGN_UP (header_size + core_size, image_target->section_align); From patchwork Mon Jan 14 15:27:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Graf X-Patchwork-Id: 155543 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp3798464jaa; Mon, 14 Jan 2019 07:43:33 -0800 (PST) X-Google-Smtp-Source: ALg8bN4QiFH1QfjsYJtmOAT0xXW2crLFo2g/Bb9kDcJIEAbuguhXpQfS5s2kPjcOTiaW6VqfAWsy X-Received: by 2002:a1c:a6c2:: with SMTP id p185mr11233080wme.133.1547480613217; Mon, 14 Jan 2019 07:43:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547480613; cv=none; d=google.com; s=arc-20160816; b=IMXntmnO+y5o824726mXr/jQyN1Mt0fyO+TuP/cO36Vm6sVQd7qZaz6gFbOibZdU4u Ns/mKAkjMXp5Hsgh1QOhf/qMGWlOCo6s5hksJWYzddQe+XefqkAraMhZ3U+qKP1JtfQy JmsT+0CrkN4g7LS3jXKQl/Ynwotu3YmopAOxkaKy0egLGPVuOJJbEIhpYWe6nmxkr2mX NrUCIijYIVFXlVgdjav+QJdjsggzeMyHH9JFgGuW9cpDuHzDEO+ruqy4/jiQbsdaUl6R 0BOtSHofWGRDwKbVkZcVpeFbV/eCjj8YC+rnrzpdmD2ORue4uD0t94e1zRERvg6rQPVE i2Mw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:references:in-reply-to:message-id:date:subject :to:from; bh=Q5DLmtv+BQp+Nh7ttRu6LbFPakp7vNCF7NTL509/1ig=; b=N4zYgdYsSZLHO3tizCKeO4MnEXuHOuvRPS72dYM8wdBMOVCsUJfz+rRcqwXtRDybG2 zAA0y1t3mzpw3Ed7iOzmPg4az9L1OKLo9MHCWNcYOnXmEhh7lFitk3O7oz5wy4X1xIOd ysxBLZU5flTo32AOXOogyLaKlZjgL+yTGALe2WgRmB85YIbpmfSVly+HkH6Y+AdiHeTF 1r1yjkcdDloxG1BFOIVTNlk38JRkcCZN/06RLZr8VM7Hh7DRaqeNwYiQ2KfgeITWa+34 gSfr/tcSL4DpOp0XB093DfPIvxVZOXcSApE1S8u2b7+6dPAKaK7StVbn4K6jpGRMtKRs UORg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of grub-devel-bounces+patch=linaro.org@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="grub-devel-bounces+patch=linaro.org@gnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id r13si7801865wrj.11.2019.01.14.07.43.32 for (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 14 Jan 2019 07:43:33 -0800 (PST) Received-SPF: pass (google.com: domain of grub-devel-bounces+patch=linaro.org@gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of grub-devel-bounces+patch=linaro.org@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="grub-devel-bounces+patch=linaro.org@gnu.org" Received: from localhost ([127.0.0.1]:57045 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gj4Oi-0000tE-88 for patch@linaro.org; Mon, 14 Jan 2019 10:43:32 -0500 Received: from eggs.gnu.org ([209.51.188.92]:41532) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gj499-0003N1-CA for grub-devel@gnu.org; Mon, 14 Jan 2019 10:27:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gj497-0008Az-3S for grub-devel@gnu.org; Mon, 14 Jan 2019 10:27:27 -0500 Received: from mx2.suse.de ([195.135.220.15]:36450 helo=mx1.suse.de) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gj496-00089d-TX for grub-devel@gnu.org; Mon, 14 Jan 2019 10:27:25 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id C3B15AEE5; Mon, 14 Jan 2019 15:27:20 +0000 (UTC) From: Alexander Graf To: grub-devel@gnu.org Subject: [PATCH v3 2/4] mkimage: Use EFI32_HEADER_SIZE define in arm-efi case Date: Mon, 14 Jan 2019 16:27:16 +0100 Message-Id: <20190114152718.60629-3-agraf@suse.de> X-Mailer: git-send-email 2.12.3 In-Reply-To: <20190114152718.60629-1-agraf@suse.de> References: <20190114152718.60629-1-agraf@suse.de> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] X-Received-From: 195.135.220.15 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: The development of GNU GRUB Cc: Jon Masters , Daniel Kiper , Leif Lindholm , Ard Biesheuvel MIME-Version: 1.0 Errors-To: grub-devel-bounces+patch=linaro.org@gnu.org Sender: "Grub-devel" The efi-arm case was defining its own header size calculation, even though it's 100% identical to the common EFI32_HEADER_SIZE definition. So let's clean it up to use the common define. Signed-off-by: Alexander Graf --- util/mkimage.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) -- 2.12.3 _______________________________________________ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel Reviewed-by: Daniel Kiper diff --git a/util/mkimage.c b/util/mkimage.c index 88b991764..a670db456 100644 --- a/util/mkimage.c +++ b/util/mkimage.c @@ -602,12 +602,7 @@ static const struct grub_install_image_target_desc image_targets[] = .decompressor_uncompressed_size = TARGET_NO_FIELD, .decompressor_uncompressed_addr = TARGET_NO_FIELD, .section_align = GRUB_PE32_SECTION_ALIGNMENT, - .vaddr_offset = ALIGN_UP (GRUB_PE32_MSDOS_STUB_SIZE - + GRUB_PE32_SIGNATURE_SIZE - + sizeof (struct grub_pe32_coff_header) - + sizeof (struct grub_pe32_optional_header) - + 4 * sizeof (struct grub_pe32_section_table), - GRUB_PE32_SECTION_ALIGNMENT), + .vaddr_offset = EFI32_HEADER_SIZE, .pe_target = GRUB_PE32_MACHINE_ARMTHUMB_MIXED, .elf_target = EM_ARM, }, From patchwork Mon Jan 14 15:27:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Graf X-Patchwork-Id: 155541 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp3794822jaa; Mon, 14 Jan 2019 07:39:44 -0800 (PST) X-Google-Smtp-Source: ALg8bN7cpo7op2NqT94tKh5fIC/QkT9ySbwWlXRhXVw3V6czzmyoPbqgPH+wiHVvckRBZ3ZBkSBL X-Received: by 2002:adf:fa05:: with SMTP id m5mr24177605wrr.155.1547480384641; Mon, 14 Jan 2019 07:39:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547480384; cv=none; d=google.com; s=arc-20160816; b=Cn0oyvmXaIFj1n47Jpn4hGkbBFwFZcGd2jnEg/ZYOiEcmrT5UeSJSrKiEm7uygah6p Cfw8eQSsvlMHsfOgU/z8J5cwqi/Q5k66CsXOrUN+NCr2G5hJMzLfXiDfN5dMT78+XHeb mCnPbGEjLu68HQCmjosiF/IQGRynBLoeCidTBbcssmPTp1S4ua3D2RfmifDlZbqjew7c mC0QcdTS5kMxDTm7xSSsicQW0WZKAs10rShxf3X6YeIhLDFl5UNnRPZ2jiMThjIrJaPP Fh5Zjqh6lbiaLbLUFhtuIiE4/PcsF43isT0VNTp75XL1wup1HktFB6qqk9gJJ+WVibBh 1gLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:references:in-reply-to:message-id:date:subject :to:from; bh=7aVPQ3yE+GuPKI2PeufUa+7OydZ4YdBfVuo5J2jU86E=; b=r8QCJEldJRoq6fBKiMn48VNT412yaExfCjYo55SQKKpXoRgjMisC70oryovBFX23bB WIQR7kv0c9Dc68OpQaUkUNfohKDn7BsRUStkqPW3xMDZNosi3LHUEZeE6fDGEzX4LGqa 6+JUQkkK71+j3AmD+FC62aL8+heXcMCbBOVvgXHhPXLQjHQb8SbfmF7Nj6bi83uVAUge wLsZNIOcB8izDLUY8zeanHTdpqjfuHgmD9GYCOVdTVbI9OS25ecEg8lsxL+gr/Vh0Bvw nlujaI29Y8BiklrzuX20FR/wb8hJgWzepbc2/IV6UNTEhvpUVjt4+ZNm6OMYRU2ouRfg qasQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of grub-devel-bounces+patch=linaro.org@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="grub-devel-bounces+patch=linaro.org@gnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id h133si19277083wmf.41.2019.01.14.07.39.44 for (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 14 Jan 2019 07:39:44 -0800 (PST) Received-SPF: pass (google.com: domain of grub-devel-bounces+patch=linaro.org@gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of grub-devel-bounces+patch=linaro.org@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="grub-devel-bounces+patch=linaro.org@gnu.org" Received: from localhost ([127.0.0.1]:56138 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gj4L1-00062j-KO for patch@linaro.org; Mon, 14 Jan 2019 10:39:43 -0500 Received: from eggs.gnu.org ([209.51.188.92]:41447) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gj495-0003MH-Mj for grub-devel@gnu.org; Mon, 14 Jan 2019 10:27:27 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gj492-00089T-CF for grub-devel@gnu.org; Mon, 14 Jan 2019 10:27:21 -0500 Received: from mx2.suse.de ([195.135.220.15]:36424 helo=mx1.suse.de) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gj492-00088k-5G for grub-devel@gnu.org; Mon, 14 Jan 2019 10:27:20 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 0C433AF99; Mon, 14 Jan 2019 15:27:19 +0000 (UTC) From: Alexander Graf To: grub-devel@gnu.org Subject: [PATCH v3 3/4] mkimage: arm64-efi: Align header to page granularity Date: Mon, 14 Jan 2019 16:27:17 +0100 Message-Id: <20190114152718.60629-4-agraf@suse.de> X-Mailer: git-send-email 2.12.3 In-Reply-To: <20190114152718.60629-1-agraf@suse.de> References: <20190114152718.60629-1-agraf@suse.de> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] X-Received-From: 195.135.220.15 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: The development of GNU GRUB Cc: Jon Masters , Daniel Kiper , Leif Lindholm , Ard Biesheuvel MIME-Version: 1.0 Errors-To: grub-devel-bounces+patch=linaro.org@gnu.org Sender: "Grub-devel" In order to enforce NX semantics on non-code pages, UEFI firmware may require that all code is EFI_PAGE_SIZE (4k) aligned. A similar change has recently been applied to edk2 to accomodate for the same fact: https://lists.01.org/pipermail/edk2-devel/2018-December/033708.html This patch adapts grub to also implement the same alignment guarantees and thus ensures we can boot even when strict permission checks are in place. Signed-off-by: Alexander Graf --- v1 -> v2: - Mention only NX requirement in patch description - Use GRUB_EFI_PAGE_SIZE v2 -> v3: - Apply alignment to all architectures --- util/mkimage.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) -- 2.12.3 _______________________________________________ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel diff --git a/util/mkimage.c b/util/mkimage.c index a670db456..6b372cba5 100644 --- a/util/mkimage.c +++ b/util/mkimage.c @@ -39,6 +39,7 @@ #include #include #include +#include #include #include #include @@ -66,14 +67,14 @@ + sizeof (struct grub_pe32_coff_header) \ + sizeof (struct grub_pe32_optional_header) \ + 4 * sizeof (struct grub_pe32_section_table), \ - GRUB_PE32_SECTION_ALIGNMENT) + GRUB_EFI_PAGE_SIZE) #define EFI64_HEADER_SIZE ALIGN_UP (GRUB_PE32_MSDOS_STUB_SIZE \ + GRUB_PE32_SIGNATURE_SIZE \ + sizeof (struct grub_pe32_coff_header) \ + sizeof (struct grub_pe64_optional_header) \ + 4 * sizeof (struct grub_pe32_section_table), \ - GRUB_PE32_SECTION_ALIGNMENT) + GRUB_EFI_PAGE_SIZE) static const struct grub_install_image_target_desc image_targets[] = { From patchwork Mon Jan 14 15:27:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Graf X-Patchwork-Id: 155536 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp3785454jaa; Mon, 14 Jan 2019 07:31:13 -0800 (PST) X-Google-Smtp-Source: ALg8bN7YyT4Y6bdfTadT/4BKJyTORrR9mDvSbllOvY9htdrWh03pLn7A1JjqnFJZPsslieJ8yYXT X-Received: by 2002:a1c:7616:: with SMTP id r22mr12250989wmc.35.1547479873828; Mon, 14 Jan 2019 07:31:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547479873; cv=none; d=google.com; s=arc-20160816; b=Klwx+9TtUUPbSMI2nhQKLT6IKmU9eKLVbo/PIN6TonbdMp5kRiI5sEuoGAIPdiznrY ONwi6YlInyR6P4Lho5ykj3T/myzbSQ2JSFh2/EUTeL64xwh7Q38Yfy1EmpsW+pMKCS+I KZrj46cFGU3VhG2w9P+re3Yn8v7BuxA4QV7gXrD/GNI2cZVS2mBvfMaFAyyrvzBNtuap eBQyddG4Twh+r6wnFKREefOuWHeXqrzGK3U/w4mtBRgdBGrOLnPSqSEk+ikp4FEbDBeK YtEACeS7rp9Yw4GJV7e1fFVPZWt6lfjhqN8AXG72degBkvNHH2crRNsNFYAnFlr1pRZa ee8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:references:in-reply-to:message-id:date:subject :to:from; bh=wbbiRxRD2Z1x81FREK20gYRYiFessToVe+jjbTQWLA4=; b=UBBkpPFiq8sNIBFkbOEaBU2BTIWrJwlatbNXI4EvO6YpiT+dqHak93OUX0gYs3/CMQ kCdhIb+uNyGK93qx60E7742MmxjXv9IKywzpiva0ahlPgrBBw4bOLAy8Dh44HnnGrwbo 82vHWRr5WZHqPRxqG4uGTPPzxm87m+KoEJFXB/3GMz0p076CEIYRlrLqKczLaLp7cwxR ZDebN7oYevqbQgZAkCDfls9rQHu+OurYpVRA1JrRivgkhCX+vwBF/LVOf4Kob8YV8dyD cE4Ob1lTp86vNJxejc3q4yS4cs2ErWhwxDVosUK4d1U5Qyytr6SwXjSEXn5B5fwzcs1p wPSQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of grub-devel-bounces+patch=linaro.org@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="grub-devel-bounces+patch=linaro.org@gnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id z4si47565376wrw.97.2019.01.14.07.31.13 for (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 14 Jan 2019 07:31:13 -0800 (PST) Received-SPF: pass (google.com: domain of grub-devel-bounces+patch=linaro.org@gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of grub-devel-bounces+patch=linaro.org@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="grub-devel-bounces+patch=linaro.org@gnu.org" Received: from localhost ([127.0.0.1]:54209 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gj4Cm-0006Al-K6 for patch@linaro.org; Mon, 14 Jan 2019 10:31:12 -0500 Received: from eggs.gnu.org ([209.51.188.92]:41452) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gj495-0003MT-QN for grub-devel@gnu.org; Mon, 14 Jan 2019 10:27:27 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gj492-00089G-Ab for grub-devel@gnu.org; Mon, 14 Jan 2019 10:27:21 -0500 Received: from mx2.suse.de ([195.135.220.15]:36410 helo=mx1.suse.de) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gj492-00088e-2Y for grub-devel@gnu.org; Mon, 14 Jan 2019 10:27:20 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id D4758AF97; Mon, 14 Jan 2019 15:27:18 +0000 (UTC) From: Alexander Graf To: grub-devel@gnu.org Subject: [PATCH v3 4/4] mkimage: Align efi sections on 4k boundary Date: Mon, 14 Jan 2019 16:27:18 +0100 Message-Id: <20190114152718.60629-5-agraf@suse.de> X-Mailer: git-send-email 2.12.3 In-Reply-To: <20190114152718.60629-1-agraf@suse.de> References: <20190114152718.60629-1-agraf@suse.de> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] X-Received-From: 195.135.220.15 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: The development of GNU GRUB Cc: Jon Masters , Daniel Kiper , Leif Lindholm , Ard Biesheuvel MIME-Version: 1.0 Errors-To: grub-devel-bounces+patch=linaro.org@gnu.org Sender: "Grub-devel" There is UEFI firmware popping up in the wild now that implements stricter permission checks using NX and write protect page table entry bits. This means that firmware now may fail to load binaries if its individual sections are not page aligned, as otherwise it can not ensure permission boundaries. So let's bump all efi section alignments up to 4k (EFI page size). That way we will stay compatible going forward. This brings us into sync with what the MS C compiler toolchain does. Signed-off-by: Alexander Graf --- util/mkimage.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) -- 2.12.3 _______________________________________________ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel diff --git a/util/mkimage.c b/util/mkimage.c index 6b372cba5..a57f277ec 100644 --- a/util/mkimage.c +++ b/util/mkimage.c @@ -194,7 +194,7 @@ static const struct grub_install_image_target_desc image_targets[] = .decompressor_compressed_size = TARGET_NO_FIELD, .decompressor_uncompressed_size = TARGET_NO_FIELD, .decompressor_uncompressed_addr = TARGET_NO_FIELD, - .section_align = GRUB_PE32_SECTION_ALIGNMENT, + .section_align = GRUB_EFI_PAGE_SIZE, .vaddr_offset = EFI32_HEADER_SIZE, .pe_target = GRUB_PE32_MACHINE_I386, .elf_target = EM_386, @@ -244,7 +244,7 @@ static const struct grub_install_image_target_desc image_targets[] = .decompressor_compressed_size = TARGET_NO_FIELD, .decompressor_uncompressed_size = TARGET_NO_FIELD, .decompressor_uncompressed_addr = TARGET_NO_FIELD, - .section_align = GRUB_PE32_SECTION_ALIGNMENT, + .section_align = GRUB_EFI_PAGE_SIZE, .vaddr_offset = EFI64_HEADER_SIZE, .pe_target = GRUB_PE32_MACHINE_X86_64, .elf_target = EM_X86_64, @@ -421,7 +421,7 @@ static const struct grub_install_image_target_desc image_targets[] = .decompressor_compressed_size = TARGET_NO_FIELD, .decompressor_uncompressed_size = TARGET_NO_FIELD, .decompressor_uncompressed_addr = TARGET_NO_FIELD, - .section_align = GRUB_PE32_SECTION_ALIGNMENT, + .section_align = GRUB_EFI_PAGE_SIZE, .vaddr_offset = EFI64_HEADER_SIZE, .pe_target = GRUB_PE32_MACHINE_IA64, .elf_target = EM_IA_64, @@ -602,7 +602,7 @@ static const struct grub_install_image_target_desc image_targets[] = .decompressor_compressed_size = TARGET_NO_FIELD, .decompressor_uncompressed_size = TARGET_NO_FIELD, .decompressor_uncompressed_addr = TARGET_NO_FIELD, - .section_align = GRUB_PE32_SECTION_ALIGNMENT, + .section_align = GRUB_EFI_PAGE_SIZE, .vaddr_offset = EFI32_HEADER_SIZE, .pe_target = GRUB_PE32_MACHINE_ARMTHUMB_MIXED, .elf_target = EM_ARM, @@ -618,7 +618,7 @@ static const struct grub_install_image_target_desc image_targets[] = .decompressor_compressed_size = TARGET_NO_FIELD, .decompressor_uncompressed_size = TARGET_NO_FIELD, .decompressor_uncompressed_addr = TARGET_NO_FIELD, - .section_align = GRUB_PE32_SECTION_ALIGNMENT, + .section_align = GRUB_EFI_PAGE_SIZE, .vaddr_offset = EFI64_HEADER_SIZE, .pe_target = GRUB_PE32_MACHINE_ARM64, .elf_target = EM_AARCH64,