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 B93D1C6FD1D for ; Tue, 14 Mar 2023 10:25:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230511AbjCNKZe (ORCPT ); Tue, 14 Mar 2023 06:25:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53088 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229949AbjCNKYp (ORCPT ); Tue, 14 Mar 2023 06:24:45 -0400 Received: from mail.ispras.ru (mail.ispras.ru [83.149.199.84]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 26BAD5FE94; Tue, 14 Mar 2023 03:24:18 -0700 (PDT) Received: from localhost.localdomain (unknown [83.149.199.65]) by mail.ispras.ru (Postfix) with ESMTPSA id 3AEEF40755C6; Tue, 14 Mar 2023 10:23:25 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 mail.ispras.ru 3AEEF40755C6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ispras.ru; s=default; t=1678789405; bh=+Rs2iCTiek3yYBbmemqEMQIzt9ito44oHZ0zp2gqc10=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YIY13fl2vX+jnARjSEo+Jv4ClNtCdXk4Pb/VJtM+8ZvDtbZgMkT8CnMO0Ah0uRMCh EOva3BjomKBhR5fGAuUY6HWaCaBouOUtq33ZsGbwBST0QntXMNxWXIFx2EJIIWcl8y Sp1t4Pjeb6CQWgnhTvv22eHB2np7MU6/5q4HTYuk= From: Evgeniy Baskov To: Ard Biesheuvel Cc: Evgeniy Baskov , Borislav Petkov , Andy Lutomirski , Dave Hansen , Ingo Molnar , Peter Zijlstra , Thomas Gleixner , Alexey Khoroshilov , Peter Jones , Gerd Hoffmann , "Limonciello, Mario" , joeyli , lvc-project@linuxtesting.org, x86@kernel.org, linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: [PATCH v5 22/27] x86/build: set type_of_loader for EFISTUB Date: Tue, 14 Mar 2023 13:13:49 +0300 Message-Id: <111d4120936d23e6023619660778444eb226a22f.1678785672.git.baskov@ispras.ru> X-Mailer: git-send-email 2.39.2 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org After switching to the local copy of boot_params, EFISTUB stopped setting type_of_loader, using the default value of 0. Restore that behavior by assigning the right value at the build time. Signed-off-by: Evgeniy Baskov --- arch/x86/boot/tools/build.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/x86/boot/tools/build.c b/arch/x86/boot/tools/build.c index 476ef05f16fb..5ac4f08ed923 100644 --- a/arch/x86/boot/tools/build.c +++ b/arch/x86/boot/tools/build.c @@ -588,6 +588,8 @@ int main(int argc, char **argv) memcpy(output + setup_size + efi_boot_params + SETUP_HEADER_OFFSET, setup_header, 0x290 - SETUP_HEADER_OFFSET /* == max possible sizeof(struct setup_header) */); + /* Set type_of_loader to the one that EFISTUB uses for the local copy */ + output[setup_size + efi_boot_params + SETUP_HEADER_OFFSET + 0x1F] = 0x21; #endif /* Calculate and write kernel checksum. */ -- 2.39.2