From patchwork Fri Jan 25 11:45:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Graf X-Patchwork-Id: 156571 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp260563jaa; Fri, 25 Jan 2019 03:49:55 -0800 (PST) X-Google-Smtp-Source: ALg8bN57TR8jWw1KXoW5wSFu/pKXex/IO2RRh/cAcyXnozYzBQFhHtSbxpBVOdJaxha0seRiW0fN X-Received: by 2002:a1c:a104:: with SMTP id k4mr6476131wme.54.1548416995325; Fri, 25 Jan 2019 03:49:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548416995; cv=none; d=google.com; s=arc-20160816; b=SycfqIphYvVylCNJ67ieYyz5Zxq3PIjbsZnGZ1JB6gwVtpJwHsUhzXwDk8QrJcTS/c WdlBT6nQR/OZa9kjjIRlW0vnAzhi2IItuYvmCUdddKGtDSvITlv/ShYit0k1m2uJel4j UntKneItFUHwAQ3FsnCwvWMjQWNRFElMXoLkhb1A7MsJqHQD1u4uWZip/SBJ6Gfxp4QG yCAUDyJW0ZDvUZqSANsPSmmF1gN96fPHbM7hC0QGisMZkWFkRmuGhxEXie/1OPw6hbT5 ocRIZMq6KlpSgR2E0jyjmHixCBoD7yMwNVrjveNcSOWO3Ku3dNNCMFfBDuA94DuMCPk4 QUTQ== 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=eCVKMzfjoduKRJwhhIk8o5X4kek1JXEzqfOWuUm0gq8=; b=1Hbs8bBkFfXuyRSdT7m3rBq3T+KvtEQ08VLgUgJhijM81ZuMlbhPPHp5ODNdjerkXZ hF0Bw7mFLiZV4Gk8YRFScnSBkgTg8RJt89UnZT4U7zJ97RhYEE85ZYS3uSXyUKFxIO57 qcxV5suBqTeB+oGPAdDSmuMflyR0NXuBT7UBrVOaD66xlbzdTvNkUCavtljAgbEzhNdZ 14fuf8enPP5UVS0jVL/G+0rL8ukpKr2A+L6Cf6doMuc+3nkDqWkOpVZvYubjZobzaecM q3PfZDOWxlqqce4UWlIiTgiHu6FPF+673ExeQtwg9DlUQ2onGJJLCbafqotKxMIQnj0t FW0Q== 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 37si30774428wrb.194.2019.01.25.03.49.55 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 25 Jan 2019 03:49:55 -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]:43051 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gmzze-0008Vf-8e for patch@linaro.org; Fri, 25 Jan 2019 06:49:54 -0500 Received: from eggs.gnu.org ([209.51.188.92]:58318) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gmzzQ-0008U4-Ra for grub-devel@gnu.org; Fri, 25 Jan 2019 06:49:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gmzzP-0004HS-SK for grub-devel@gnu.org; Fri, 25 Jan 2019 06:49:40 -0500 Received: from mx2.suse.de ([195.135.220.15]:52248 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 1gmzzP-0004Bp-Jj for grub-devel@gnu.org; Fri, 25 Jan 2019 06:49:39 -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 D8CF9ADF5; Fri, 25 Jan 2019 11:49:28 +0000 (UTC) From: Alexander Graf To: grub-devel@gnu.org Subject: [PATCH v5 1/3] mkimage: Use EFI32_HEADER_SIZE define in arm-efi case Date: Fri, 25 Jan 2019 12:45:14 +0100 Message-Id: <20190125114516.12127-2-agraf@suse.de> X-Mailer: git-send-email 2.12.3 In-Reply-To: <20190125114516.12127-1-agraf@suse.de> References: <20190125114516.12127-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 , Leif Lindholm , Daniel Kiper 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 353bb1098..16af12e0c 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 Fri Jan 25 11:45: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: 156573 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp262205jaa; Fri, 25 Jan 2019 03:51:49 -0800 (PST) X-Google-Smtp-Source: ALg8bN6FjftpDKjYzN6FTQ3QDGZeO4+zLTwO38NE2KD3Q7h9j8bzo/PIhdNcmjcHtVnE0lQw/4rX X-Received: by 2002:adf:e149:: with SMTP id f9mr12054746wri.42.1548417108937; Fri, 25 Jan 2019 03:51:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548417108; cv=none; d=google.com; s=arc-20160816; b=C95+NoNiEQlCdaN1bc/4a+fxGM/J5MasSc45fvC5WRqjz2WHj4unOQrql/pa/U1GGc qd3hcWT73GnmQ3GEKga5wZNnC+56sZbthdeVwMr789Y9GfsT+exJZiwfTkMMUHhQVgKq 8A+t7lZa7YPewKRKECQITbt0tdb7J+1Mr9hvArOwuoktlX91farQ6im0xMEJizPgDjSi EmrRFFujKh9VuGoz5mQmJG00nFLFs5cyqHxQ/sajqFEYeC1d+YKhmZjsgdDN8bkTlzJs TcBchutaZJt0OkS7jWeTH4SATWLK/hTwNY8ez0RqZ+7fOApdlscJQQLey4C6CldC158Z dOOw== 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=zswuIumg96/AWOuvKvfMIDDGkHz/gEpFE5Yovbm+eIE=; b=MMt+X0CgJndUNkj6Eyeg+FVYFJKQvfFjuTbH8EQ9ekvcCOZ+kV0amMcklESd5VMe02 uwfMuxfHrH1oeuuJSCw1uha/XH+N2DmWTLRLNk3S4C95njBXj0VNRpBzOojZwKK+il08 I56iZ4OGz2LKa/d+RJ87TELaRQxg2boVZnIYehipwEY7QeGfmLAxIcNibx0bHc3QmHrC Q3inZPozlrSjN0kkxvOxss1ablE79W1sgHtuZMN5cGFZ55B7wpNO+hrnY8UkYvhLCiDG kKbvfGKBgMeDJwdvJdM6JVJmlb4NE7eJEnyppirTnAKVp95zQlxl1JxbnFbRQeP2a4BS ZhUQ== 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 186si40423801wmc.87.2019.01.25.03.51.48 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 25 Jan 2019 03:51:48 -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]:43099 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gn01T-0001U5-W6 for patch@linaro.org; Fri, 25 Jan 2019 06:51:48 -0500 Received: from eggs.gnu.org ([209.51.188.92]:58328) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gmzzR-0008UX-Dk for grub-devel@gnu.org; Fri, 25 Jan 2019 06:49:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gmzzP-0004Hk-Td for grub-devel@gnu.org; Fri, 25 Jan 2019 06:49:41 -0500 Received: from mx2.suse.de ([195.135.220.15]:52276 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 1gmzzP-0004Bw-Jx for grub-devel@gnu.org; Fri, 25 Jan 2019 06:49:39 -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 D0AC7ADC9; Fri, 25 Jan 2019 11:49:28 +0000 (UTC) From: Alexander Graf To: grub-devel@gnu.org Subject: [PATCH v5 2/3] mkimage: Align efi sections on 4k boundary Date: Fri, 25 Jan 2019 12:45:15 +0100 Message-Id: <20190125114516.12127-3-agraf@suse.de> X-Mailer: git-send-email 2.12.3 In-Reply-To: <20190125114516.12127-1-agraf@suse.de> References: <20190125114516.12127-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 , Leif Lindholm , Daniel Kiper 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. Unfortunately our internals can't deal very well with a mismatch of alignment between the virtual and file offsets, so we have to also pad our target binary a bit. Signed-off-by: Alexander Graf --- v4 -> v5: - Use GRUB_EFI_PAGE_SIZE - Add include to have above const defined --- include/grub/efi/pe32.h | 10 ++++++++-- 1 file changed, 8 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/include/grub/efi/pe32.h b/include/grub/efi/pe32.h index 7d44732d2..fe8a85ce6 100644 --- a/include/grub/efi/pe32.h +++ b/include/grub/efi/pe32.h @@ -20,6 +20,7 @@ #define GRUB_EFI_PE32_HEADER 1 #include +#include /* The MSDOS compatibility stub. This was copied from the output of objcopy, and it is not necessary to care about what this means. */ @@ -50,8 +51,13 @@ /* According to the spec, the minimal alignment is 512 bytes... But some examples (such as EFI drivers in the Intel Sample Implementation) use 32 bytes (0x20) instead, and it seems - to be working. For now, GRUB uses 512 bytes for safety. */ -#define GRUB_PE32_SECTION_ALIGNMENT 0x200 + to be working. + + However, there is firmware showing up in the field now with + page alignment constraints to guarantee that page protection + bits take effect. Because we can not easily distinguish between + in-memory and in-file layout, let's bump all alignment to 4k. */ +#define GRUB_PE32_SECTION_ALIGNMENT GRUB_EFI_PAGE_SIZE #define GRUB_PE32_FILE_ALIGNMENT GRUB_PE32_SECTION_ALIGNMENT struct grub_pe32_coff_header From patchwork Fri Jan 25 11:45: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: 156572 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp260662jaa; Fri, 25 Jan 2019 03:50:02 -0800 (PST) X-Google-Smtp-Source: ALg8bN6MjJl5e8UyiWqqXmwjkXM60n7UQsKI4hVLe9IsZJVUSlo5DVzNkEHULkiVLaX+7mP+oWJ/ X-Received: by 2002:adf:9b11:: with SMTP id b17mr11236179wrc.168.1548417001984; Fri, 25 Jan 2019 03:50:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548417001; cv=none; d=google.com; s=arc-20160816; b=iqLoCvx7Llt6eS0aAQjQ9ymYW3endQMNPa9e07Gkv7WWAW1kh0yryA5V0R508Lm2PG paI9Pvy4M7FjGDjfwpQ2eyh0BYwOdT8Gs/AuCO3aeQOhO1v90Jthi8/RisQinVsN3cpc vGnY06r4LK2ykrW5UGedwrnax7rj/uWvW89lrbmAaNqDwj6oIWr6Prgta7dc2sxVW0ZT O+NkSPU9zmij35WYdbMcmFqCIBIhQo8jCR6EhHUvHGmPWSyaXQtw/DTaxpLQo5/sT3M3 ywgLDcfjIPNoE37H9tPghU065Y5lkFSEFGu2baOb2njhLL2VrDNoJPkX1qHZ5hYoT3xy Kfgg== 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=xZ6F+BVHDubGmLwI7XJs+METJy7MyyYGlp6CKd6zwGw=; b=QjqofzA+MFkStsnbdhdL1bQZ32JzQ2AkUUVPSt9OR7g7LdbPY+UUTY/bDPTuBiGxoG qr4FgctkJPBGaYsKhbDe4Ph/SunoTRLOs5SEcG94si1KvU5Ljj4/UQDgsY6XNsTlAYaC a9vpQpGcMLLLVNGIIWlIaqfLagI+YH8PkHYAfv/oXb83ixfdfFMF+gRLPggpuY1Fwk5t 4SorGz0dbb7CGTFXNNtVmM2/Qns0utlz1m64gePF8MZLfIhI4tPWSVHX/7DU7xnxO4nv w2tj2LLNzOzZ8fxdfBLT72B9omlcHFANiXi114zAUuOqw4lX2OSLNbKHS+tENZS7Opno hIRQ== 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 v126si42868682wmf.58.2019.01.25.03.50.01 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 25 Jan 2019 03:50:01 -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]:43053 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gmzzl-00006V-0d for patch@linaro.org; Fri, 25 Jan 2019 06:50:01 -0500 Received: from eggs.gnu.org ([209.51.188.92]:58331) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gmzzR-0008Ud-Gw for grub-devel@gnu.org; Fri, 25 Jan 2019 06:49:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gmzzP-0004Hb-T5 for grub-devel@gnu.org; Fri, 25 Jan 2019 06:49:41 -0500 Received: from mx2.suse.de ([195.135.220.15]:52266 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 1gmzzP-0004Bv-Jl for grub-devel@gnu.org; Fri, 25 Jan 2019 06:49:39 -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 CDEDCADC8; Fri, 25 Jan 2019 11:49:28 +0000 (UTC) From: Alexander Graf To: grub-devel@gnu.org Subject: [PATCH v5 3/3] mkimage: Clarify file alignment in efi case Date: Fri, 25 Jan 2019 12:45:16 +0100 Message-Id: <20190125114516.12127-4-agraf@suse.de> X-Mailer: git-send-email 2.12.3 In-Reply-To: <20190125114516.12127-1-agraf@suse.de> References: <20190125114516.12127-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 , Leif Lindholm , Daniel Kiper MIME-Version: 1.0 Errors-To: grub-devel-bounces+patch=linaro.org@gnu.org Sender: "Grub-devel" There are a few spots in the PE generation code for EFI binaries that uses the section alignment rather than file alignment, even though the alignment is really only file bound. Replace those cases with the file alignment constant instead. Reported-by: Daniel Kiper Signed-off-by: Alexander Graf --- util/mkimage.c | 8 ++++---- 1 file changed, 4 insertions(+), 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 16af12e0c..6631bfe45 100644 --- a/util/mkimage.c +++ b/util/mkimage.c @@ -1227,10 +1227,10 @@ grub_install_generate_image (const char *dir, const char *prefix, header_size = EFI64_HEADER_SIZE; reloc_addr = ALIGN_UP (header_size + core_size, - image_target->section_align); + GRUB_PE32_FILE_ALIGNMENT); pe_size = ALIGN_UP (reloc_addr + layout.reloc_size, - image_target->section_align); + GRUB_PE32_FILE_ALIGNMENT); pe_img = xmalloc (reloc_addr + layout.reloc_size); memset (pe_img, 0, header_size); memcpy ((char *) pe_img + header_size, core_img, core_size); @@ -1280,7 +1280,7 @@ grub_install_generate_image (const char *dir, const char *prefix, o->image_base = 0; o->section_alignment = grub_host_to_target32 (image_target->section_align); - o->file_alignment = grub_host_to_target32 (image_target->section_align); + o->file_alignment = grub_host_to_target32 (GRUB_PE32_FILE_ALIGNMENT); o->image_size = grub_host_to_target32 (pe_size); o->header_size = grub_host_to_target32 (header_size); o->subsystem = grub_host_to_target16 (GRUB_PE32_SUBSYSTEM_EFI_APPLICATION); @@ -1315,7 +1315,7 @@ grub_install_generate_image (const char *dir, const char *prefix, o->code_base = grub_cpu_to_le32 (header_size); o->image_base = 0; o->section_alignment = grub_host_to_target32 (image_target->section_align); - o->file_alignment = grub_host_to_target32 (image_target->section_align); + o->file_alignment = grub_host_to_target32 (GRUB_PE32_FILE_ALIGNMENT); o->image_size = grub_host_to_target32 (pe_size); o->header_size = grub_host_to_target32 (header_size); o->subsystem = grub_host_to_target16 (GRUB_PE32_SUBSYSTEM_EFI_APPLICATION);