Message ID | 20230912065500.886599632@linutronix.de |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9ecd:0:b0:3f2:4152:657d with SMTP id t13csp245606vqx; Tue, 12 Sep 2023 01:00:44 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGDisCi/QHhpXXdvcu9wIufyU+l7v9cLvL5+HD+iycISieA+qnaN0bG5BbTAS+c1pfKCVGk X-Received: by 2002:a17:902:ea0d:b0:1c3:2423:8e24 with SMTP id s13-20020a170902ea0d00b001c324238e24mr12248741plg.8.1694505644045; Tue, 12 Sep 2023 01:00:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694505644; cv=none; d=google.com; s=arc-20160816; b=iMqK8bCSzA2VRRmgWXGZB5GB8h9MtMsOwaAfwKfQKUhA16iVa+cBL00Mga9E2d6Tz9 UcKSf0UxGukeOBAhTwzmpRfy2SOcjssYRlGIriYPHB9VUt3IiYtBavqOsE6VWS27Z3mV 0ksnfrgKsVTyqN1/OcdeWt2Jf4RHnfJyTxomLXMWBNKW1EyFCAekizIMLBk3zOPftsuw 4UcvuIlwRUui44LijiGWd5QgILWs8cWxEQnirhLwsr0F2jFnGecRcYhR64pn7INEDUk5 XGxxfkvcBK6u+yk6fb+FTqrxaQ97q8tHSxL9pTXh11zLofmn3G7klX+nPH9OowVejmrK qNXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:date:mime-version:references:subject:cc:to:from :dkim-signature:dkim-signature:message-id; bh=w4iWy4H04gKoxDxbBdcXl1DLzwa8M24xJYhbSoNX0o4=; fh=u57tXYamzTrJA+Ht8n1u7SfTMptrQaIb6LVW+jsaYf4=; b=nnqjSf76JabOI97AcAUKbs0AlE4/OlgoCxIkfdDWRFZWHUEhQLvbh/ztgRgQpSBeQE jBINFNojS9JGz60cDIzzaNPwGp91McMCuuBMQojmbcCllgSEU6PCJtU2OCtBCf/D1WCH +qLZaudMPvna+VXjZWsfPuYW0oBrC0SzGCJDkeWEkVrZxu5D/GB3rHpRrF68uy4wYjdS RMwUD4mGNEdnZwOISTeB4E6UlwdvpByrq8SVvgQnhyoo0J0CumhKOwQLo0CAuGr05edy KBToGCVvd9uBn9+akm2+kUoJRkY9oOL9dbrUyORprYQNPhXuQV7m9VMddPO0jZkYuw2r Ozcw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=QVS7DXoH; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=fR4UnP7R; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id i4-20020a170902e48400b001b9c7300823si7305549ple.221.2023.09.12.01.00.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Sep 2023 01:00:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=QVS7DXoH; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=fR4UnP7R; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 0CA5E80298AF; Tue, 12 Sep 2023 00:59:18 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.8 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231887AbjILH57 (ORCPT <rfc822;pwkd43@gmail.com> + 39 others); Tue, 12 Sep 2023 03:57:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48124 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231571AbjILH5w (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 12 Sep 2023 03:57:52 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5D808E7C for <linux-kernel@vger.kernel.org>; Tue, 12 Sep 2023 00:57:48 -0700 (PDT) Message-ID: <20230912065500.886599632@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1694505467; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: references:references; bh=w4iWy4H04gKoxDxbBdcXl1DLzwa8M24xJYhbSoNX0o4=; b=QVS7DXoHfiAtIMT7nPbf0KrP6V5vPE3x1jqj17hq83l58q7P0CiBSeqOYOSAgszoPRRM9J civFqb+6Pwy9vMgNKeOBngH+zSSwDoNC3ehWh2/r0E9Ek2LswhofmNnOanwBawgZN+WppN 4z0EyFvWIDdcTtbAZr8VTNinktpYQTJ3+rkO0eyI5dIMcCcJTl6t1ZN7xeRxgSpL+AycIp wwDP4veUqz305eFXyzEeWoOs4gN4zU8yJZfYjqOX/+o1vMfhW1U1MMFpo5xv1Z6eLQXRG5 SocWvTc/gCFwxStw5A7ApDzS5l6PNIva4RzMoR3CptQyOQbBDDBLrWY8k6UPgQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1694505467; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: references:references; bh=w4iWy4H04gKoxDxbBdcXl1DLzwa8M24xJYhbSoNX0o4=; b=fR4UnP7Rrd5eP0Du3qjVv8dtgpIH2R/xhVPFAjUnYJjXBL58MlfMA73V6Yj0AMk1m+0KcZ S9mGLs/V6hqSRBCQ== From: Thomas Gleixner <tglx@linutronix.de> To: LKML <linux-kernel@vger.kernel.org> Cc: x86@kernel.org, Borislav Petkov <bp@alien8.de>, "Chang S. Bae" <chang.seok.bae@intel.com>, Arjan van de Ven <arjan@linux.intel.com>, Nikolay Borisov <nik.borisov@suse.com> Subject: [patch V3 02/30] x86/boot/32: Disable stackprotector and tracing for mk_early_pgtbl_32() References: <20230912065249.695681286@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Date: Tue, 12 Sep 2023 09:57:46 +0200 (CEST) Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Tue, 12 Sep 2023 00:59:19 -0700 (PDT) X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1776817950180076022 X-GMAIL-MSGID: 1776817950180076022 |
Series |
x86/microcode: Cleanup and late loading enhancements
|
|
Commit Message
Thomas Gleixner
Sept. 12, 2023, 7:57 a.m. UTC
Stackprotector cannot work before paging is enabled. The read from the per
CPU variable __stack_chk_guard is always accessing the virtual address
either directly on UP or via FS on SMP. In physical address mode this
results in an access to memory above 3GB.
So this works by chance as the hardware returns the same value when there
is no RAM at this physical address. When there is RAM populated above 3G
then the read is by chance the same as nothing changes that memory during
the very early boot stage.
Stop relying on pure luck and disable the stack protector for the only C
function which is called during early boot before paging is enabled.
Remove function tracing from the whole source file as there is no way to
trace this at all, but in case of CONFIG_DYNAMIC_FTRACE=n
mk_early_pgtbl_32() would access global function tracer variables in
physcial address mode which again might work by chance.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
arch/x86/kernel/Makefile | 1 +
arch/x86/kernel/head32.c | 3 ++-
2 files changed, 3 insertions(+), 1 deletion(-)
--- a/arch/x86/kernel/Makefile +++ b/arch/x86/kernel/Makefile @@ -16,6 +16,7 @@ CFLAGS_REMOVE_kvmclock.o = -pg CFLAGS_REMOVE_ftrace.o = -pg CFLAGS_REMOVE_early_printk.o = -pg CFLAGS_REMOVE_head64.o = -pg +CFLAGS_REMOVE_head32.o = -pg CFLAGS_REMOVE_sev.o = -pg CFLAGS_REMOVE_rethook.o = -pg endif --- a/arch/x86/kernel/head32.c +++ b/arch/x86/kernel/head32.c @@ -73,7 +73,8 @@ asmlinkage __visible void __init __noret * always zero at this stage. */ void __init mk_early_pgtbl_32(void); -void __init mk_early_pgtbl_32(void) + +void __init __no_stack_protector mk_early_pgtbl_32(void) { #ifdef __pa #undef __pa