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,