From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 89CD9C433FE for ; Thu, 20 Oct 2022 13:07:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230339AbiJTNHb (ORCPT ); Thu, 20 Oct 2022 09:07:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54784 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230346AbiJTNH1 (ORCPT ); Thu, 20 Oct 2022 09:07:27 -0400 Received: from mail.ispras.ru (mail.ispras.ru [83.149.199.84]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4171115DB03; Thu, 20 Oct 2022 06:07:24 -0700 (PDT) Received: from mail.ispras.ru (unknown [83.149.199.84]) by mail.ispras.ru (Postfix) with ESMTPSA id 885DD40D403D; Thu, 20 Oct 2022 13:07:19 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 mail.ispras.ru 885DD40D403D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ispras.ru; s=default; t=1666271239; bh=Fm3xulfEjrseVDMk6eOF4edzLS36E5lkjUcNbZAms6E=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=Yps6bo4xui0X6APcx20IjhqluRZUsPCmjPVkpw5gTEMQeLVLF30EAM634Mtp5wf98 xnsVWJFV4VuQVP2379f1JWbvi6aAD41Ns1HnwmNTiMhVCkdG/IfqWRQgJ+tHTWJi1k xgr+KSa5Dtjp0wyjhb7MEA+dF+k4kyJvcMQlvURw= MIME-Version: 1.0 Date: Thu, 20 Oct 2022 16:07:19 +0300 From: Evgeniy Baskov To: Ard Biesheuvel Cc: Borislav Petkov , Andy Lutomirski , Dave Hansen , Ingo Molnar , Peter Zijlstra , Thomas Gleixner , Alexey Khoroshilov , lvc-project@linuxtesting.org, x86@kernel.org, linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: Re: [PATCH 14/16] x86/build: Make generated PE more spec compliant In-Reply-To: References: User-Agent: Roundcube Webmail/1.4.4 Message-ID: <9c9192e0509b696f46e559d447769b30@ispras.ru> X-Sender: baskov@ispras.ru Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2022-10-19 10:39, Ard Biesheuvel wrote: > On Tue, 6 Sept 2022 at 12:42, Evgeniy Baskov wrote: >> >> Currently kernel image is not fully compliant PE image, so it may >> fail to boot with stricter implementations of UEFI PE loaders. >> >> Set minimal alignments and sizes specified by PE documentation [1] >> referenced by UEFI specification [2]. Align PE header to 8 bytes. > > >> Generate '.reloc' section with 2 entries and set reloc data directory. > > Why? It seems to me that I saw minimal size requirement in MS documentation, but now I cannot find the proof of my words, so I've probably misread. So I'll drop this change. > > >> >> To make code more readable refactor tools/build.c: >> - Use mmap() to access kernel image. >> - Generate sections dynamically. >> - Setup sections protection. Since we cannot fit every >> needed section, set a part of protection flags >> dynamically during initialization. This step is omitted >> if CONFIG_EFI_DXE_MEM_ATTRIBUTES is not set. >> > > If the commit log of a patch contains a bulleted list of the changes > that it implements, it is a very strong indicator that it needs to be > split up. Presenting this as a big ball of changes makes the life of a > reviewed unnecessarily hard. > Sorry for that, I'll try to separate this into several patches.