From patchwork Wed Apr 12 18:44:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Gerst X-Patchwork-Id: 82634 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp543627vqo; Wed, 12 Apr 2023 12:04:10 -0700 (PDT) X-Google-Smtp-Source: AKy350YxUUQQXn0TeHq2QingP1bOyKTxd1/unNs1PVO1yavd1YuYFiX/fpnQIwtNpAtaQUAq3gbp X-Received: by 2002:aa7:9831:0:b0:625:ce95:f2ba with SMTP id q17-20020aa79831000000b00625ce95f2bamr16431335pfl.22.1681326250508; Wed, 12 Apr 2023 12:04:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681326250; cv=none; d=google.com; s=arc-20160816; b=eDYPJH6GfiL+VOxiGGolUs7DIUbQjHQ5ZADGJwpg7JTBMyvIVNIRayY3LtqZ4h9qEq JwtaYb+Ow71UKiYxudYRJfreQ9pf619KQAgqAcUSy/hBS1bXHa1o51KzUVP/T1hYArBU IiUiV69NXijEBXMXqCfyxhVD8WzplNNmTfoyJEglZRW2M8JW1FV/z9A7soC5P30c1B1w zIw/b10pe2uXYZLuo1GVD9diWb3lle6Apk7r4Ug5seUlP82gKbW0wOektlOmvQ1RiDqP sccRkTFC0SN+uCg4ohxmXG/eRelRcaUE98uvJlpwUrD+/Oh1gvfqeE28La+Y6rMrVTuo dcqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=RI1QKnyB9mb6UAnZmBnXQzU2ONFlsltTDGtKyyUD28o=; b=h4iu223D47tdcr0DtyGyBDJXNJrqVgi1dcmnAvtYkc3FuTY55hR+Zu01Zo2HUwyOUv AVSEkckCYhrzgJwvGBjkI9WQuGCNpRfz3XlehnH6A8f9yJb3F/pz/fhDpi4B+4/SSLcq D3UQUoQSPAssjwB5JYTawCcBXMaqTZfrPe6OFcslwbb426aODHzO1K6Xk5Fkk+ZneMLv DUkaVXaHLTNep1f90YUNjbT2InPsrTTuy6iDjyCcUIFKaSmXUNsjclH7pqf6jYrFvh1o P/KNomRo7jedVMaT8cV4ZGPQBojlzitiiLg1TRw/ycgyQHIs84JRZOeojF4HpqnwawZ4 NWYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=OYyMovpl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d5-20020aa797a5000000b0063b1f577d26si1040683pfq.194.2023.04.12.12.03.57; Wed, 12 Apr 2023 12:04:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=OYyMovpl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230182AbjDLSpU (ORCPT + 99 others); Wed, 12 Apr 2023 14:45:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55232 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229982AbjDLSpM (ORCPT ); Wed, 12 Apr 2023 14:45:12 -0400 Received: from mail-oa1-x33.google.com (mail-oa1-x33.google.com [IPv6:2001:4860:4864:20::33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3F45740F2 for ; Wed, 12 Apr 2023 11:45:11 -0700 (PDT) Received: by mail-oa1-x33.google.com with SMTP id 586e51a60fabf-1842e8a8825so14801824fac.13 for ; Wed, 12 Apr 2023 11:45:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681325110; x=1683917110; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=RI1QKnyB9mb6UAnZmBnXQzU2ONFlsltTDGtKyyUD28o=; b=OYyMovplh1Vk8gmeTpVI2bCmkYXiwH5ziby48r9n0AvhtcqaTm8fO/ndGn4OpgUHDb 6sTNMGcYtsDrpzbMk+juJap0e2YXhwAdgK30G8fhDrq+Ua+541vkhpWMvJHXn7Gq+oC+ rGjlZIy1jH9isHXk2Fv/ojCUXjV5VDmUNwGHAUpupqPOCMfGdAiJaYGOpYmHFQzskV6d s91+npBXcNNXBiEscdIykjowHr4UHgXPLO0iXt1CbtMx65AsAluR+ebGxIQ41ntIvd7S RywhwBrf2n8a0QgD3NKT7NF4U/MzMB9oViG0bjhmJveAiY6lFhFLMl3bNKeLqi1BACJk shDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681325110; x=1683917110; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=RI1QKnyB9mb6UAnZmBnXQzU2ONFlsltTDGtKyyUD28o=; b=MT8dJvcmpthqEIzN0Godw9KEBhcAQWkgmavPz3PQcPXuzxabTysoMbx0/8gAs63xej yP/6qM+AMMSYt2ENQSmjZi9vLrigMHAUBxRBvX35gMM7Iw8o0ejlZtKniR3p4uiG9Dsi qRRhYApHZ1vRHPD/YG13yROJPj31ndn7aHF6plnl9W2e2k0GFdc+U5tsa4v/GYQre4v5 FCVvGrLbbbG0YTJXnPyP/pbtIV52YTevy/n5fWZY3Fz9rhILshiunDsw7DeJK0SLYbRf QhAmQoJr00oFc5YdRPcjSj46fB6uQa93KBvT2AjruwbG9Xs4gSKk5DTCe+owWWHGOAfm 2FLw== X-Gm-Message-State: AAQBX9eRO/98huTdnN2f/zAtAQYd89DzdaGqo1eBLyRv2GfVMJMTtlgN uQPYCzQs556VysY8VlMHSIZaT0DrcA== X-Received: by 2002:a05:6870:40cc:b0:177:b9d3:c028 with SMTP id l12-20020a05687040cc00b00177b9d3c028mr7724458oal.12.1681325110388; Wed, 12 Apr 2023 11:45:10 -0700 (PDT) Received: from citadel.. (075-129-116-198.res.spectrum.com. [75.129.116.198]) by smtp.gmail.com with ESMTPSA id w24-20020a9d77d8000000b00690e990e61asm6706020otl.14.2023.04.12.11.45.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Apr 2023 11:45:10 -0700 (PDT) From: Brian Gerst To: linux-kernel@vger.kernel.org, x86@kernel.org Cc: Thomas Gleixner , Borislav Petkov , "H . Peter Anvin" , Peter Zijlstra , Ingo Molnar , Brian Gerst Subject: [PATCH v2 1/6] x86/boot: Move sanitize_boot_params() Date: Wed, 12 Apr 2023 14:44:57 -0400 Message-Id: <20230412184502.145289-2-brgerst@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230412184502.145289-1-brgerst@gmail.com> References: <20230412184502.145289-1-brgerst@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1762998354197334456?= X-GMAIL-MSGID: =?utf-8?q?1762998354197334456?= sanitize_boot_params() contains a static table that would need to be addressed in a PIC manner if it were executed early in the boot process while using the identity-mapped page tables. Separate it from copy_bootdata(). Signed-off-by: Brian Gerst --- arch/x86/kernel/head64.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/x86/kernel/head64.c b/arch/x86/kernel/head64.c index 387e4b12e823..4a3b195c9002 100644 --- a/arch/x86/kernel/head64.c +++ b/arch/x86/kernel/head64.c @@ -455,7 +455,6 @@ static void __init copy_bootdata(char *real_mode_data) sme_map_bootdata(real_mode_data); memcpy(&boot_params, real_mode_data, sizeof(boot_params)); - sanitize_boot_params(&boot_params); cmd_line_ptr = get_cmd_line_ptr(); if (cmd_line_ptr) { command_line = __va(cmd_line_ptr); @@ -543,6 +542,8 @@ void __init x86_64_start_reservations(char *real_mode_data) if (!boot_params.hdr.version) copy_bootdata(__va(real_mode_data)); + sanitize_boot_params(&boot_params); + x86_early_init_platform_quirks(); switch (boot_params.hdr.hardware_subarch) {