[tip:,x86/microcode] x86/boot/32: Disable stackprotector and tracing for mk_early_pgtbl_32()
Message ID | 169685459633.3135.10588556494903023033.tip-bot2@tip-bot2 |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a888:0:b0:403:3b70:6f57 with SMTP id x8csp1834165vqo; Mon, 9 Oct 2023 05:32:57 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGNXCqT8BTv9oUUQe+5HRBLCJLePK5DVutAcO8egd3sM/gM5iOALyILlRoEwAOS4FyeDofI X-Received: by 2002:a17:902:6f02:b0:1b8:94e9:e7b0 with SMTP id w2-20020a1709026f0200b001b894e9e7b0mr10985431plk.9.1696854777285; Mon, 09 Oct 2023 05:32:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696854777; cv=none; d=google.com; s=arc-20160816; b=OicItDlbC4OoKV28RqXFWOac3b38Tec6P+p/w1YlQPcLGTB7RXt1Upx5y8Bpv99Dfu 05DdDWNcsxrhlDQ7Uu1O2r0xp/dkds6ZdDoyrLF5Wz7DxOcxTWIfdGt/5GfnZQvixJd5 UE1iGos69QOy5vVOtu0Xbj6qDiWnomzULfaZYIXZSY1mluUp8IGjysgzQz/1wP0ugznt UGxWV1kJFgagnuEDbF+mHxn5/XnDaLjphcUbIYiTCOJOWvoSXCWCbTo9jsw+Ac3ifaEb lU1I5a0YKB/cldV1OCpK7uV5vjv5ERaeWBwmJcLQ3RkXcCh2RRwwz3P7ZKBk869QWQNS JSEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=Z8ksFlmH8l12KjEXC71P0Q65qAQVpeKQXFiaMDA686k=; fh=LWlv3U+xZ3+vQt4tlJRIlKl5VzN7iFjjE/bzRmlxKDA=; b=RBlppVJot5NsOw4tqErJ5Wh7EJp6KHcrlCAkwPHKjF0EjVvYvKJDThK0h9Alih8oNZ +j6r4Zb8MlrrVQv86654uQMj0N6cqRJLhN27wOGz/FPGR5AxNQOX9Vjnihmc/MuowM6a Rx7nNid+n+p746ki6ShmhFIc5MyxJf63CqPkc6eDvP3sRfPW6X1fIum5en3pdUDoj+Z+ HQ7/uZiz6urfEtB0F8+yiKHtpIpV3VS97W735EkUel/E0oEQ7Ft7pVelK1IZEC36367Q b7KC1s46jyvACjR5pBdniGZ0MG39cLyYYuODYf/q8QKRVSG4qMRyfQlw5m8v9AYE2sxK nBYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=FsZLYOtj; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=IHxzndGT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 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. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id k4-20020a170902d58400b001c7845637eesi9418115plh.168.2023.10.09.05.32.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Oct 2023 05:32:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=FsZLYOtj; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=IHxzndGT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 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 E2DF38068FEF; Mon, 9 Oct 2023 05:32:44 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376687AbjJIMbW (ORCPT <rfc822;ezelljr.billy@gmail.com> + 18 others); Mon, 9 Oct 2023 08:31:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346597AbjJIMaG (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 9 Oct 2023 08:30:06 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7F6ED115; Mon, 9 Oct 2023 05:29:58 -0700 (PDT) Date: Mon, 09 Oct 2023 12:29:56 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1696854597; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Z8ksFlmH8l12KjEXC71P0Q65qAQVpeKQXFiaMDA686k=; b=FsZLYOtjwo06nspYDw/Ak6qHTQciRNgRUGSpSfe0CPvMl+q/aRQPGfwikFjVS+dFN0iDXD Vhm7Q9k+jy5xynjpXP73/5KB6O/n6RWU+wzxCSn/yejabJhNLNO1rRmnWQZA4T6wc97Lmd zKK7IaSk2UoWpepugE0EALshZcGZC8BlHkHvmgcMnnEbuuM+vzllK3HrhYUuLC6IjiY1kF SK+vJ5FidbkmDz6e7CBggprTb6n5I9VVUFQLcY3nbo2qF45tydtXeLPCm3ivh5kOx63+Zx KJOUVPTy1NM+BnqLcBUlFwBZcgpDNTmDvYNyCksjhGNJzFBW1H7H0J07N70KEw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1696854597; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Z8ksFlmH8l12KjEXC71P0Q65qAQVpeKQXFiaMDA686k=; b=IHxzndGTYbxNMdwTZjDvK5ZaHcOT1TN1MjyxdwY8g/keh48DpIh6eIor+6xt3HJK2rKdHE amJ31ZLYP+bmYfAA== From: "tip-bot2 for Thomas Gleixner" <tip-bot2@linutronix.de> Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/microcode] x86/boot/32: Disable stackprotector and tracing for mk_early_pgtbl_32() Cc: Thomas Gleixner <tglx@linutronix.de>, "Borislav Petkov (AMD)" <bp@alien8.de>, x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20231002115902.156063939@linutronix.de> References: <20231002115902.156063939@linutronix.de> MIME-Version: 1.0 Message-ID: <169685459633.3135.10588556494903023033.tip-bot2@tip-bot2> Robot-ID: <tip-bot2@linutronix.de> Robot-Unsubscribe: Contact <mailto:tglx@linutronix.de> to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=2.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email 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]); Mon, 09 Oct 2023 05:32:45 -0700 (PDT) X-Spam-Level: ** X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778683407152020721 X-GMAIL-MSGID: 1779281194853015066 |
Series |
[tip:,x86/microcode] x86/boot/32: Disable stackprotector and tracing for mk_early_pgtbl_32()
|
|
Commit Message
tip-bot2 for Thomas Gleixner
Oct. 9, 2023, 12:29 p.m. UTC
The following commit has been merged into the x86/microcode branch of tip: Commit-ID: b6bedf0825b8a74edef6fa7100cb078e879bbce7 Gitweb: https://git.kernel.org/tip/b6bedf0825b8a74edef6fa7100cb078e879bbce7 Author: Thomas Gleixner <tglx@linutronix.de> AuthorDate: Mon, 02 Oct 2023 13:59:36 +02:00 Committer: Borislav Petkov (AMD) <bp@alien8.de> CommitterDate: Mon, 02 Oct 2023 18:25:49 +02:00 x86/boot/32: Disable stackprotector and tracing for mk_early_pgtbl_32() 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 physical address mode which again might work by chance. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Link: https://lore.kernel.org/r/20231002115902.156063939@linutronix.de --- arch/x86/kernel/Makefile | 1 + arch/x86/kernel/head32.c | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile index 3269a0e..0000325 100644 --- 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 diff --git a/arch/x86/kernel/head32.c b/arch/x86/kernel/head32.c index bde27a3..f34b15c 100644 --- a/arch/x86/kernel/head32.c +++ b/arch/x86/kernel/head32.c @@ -73,7 +73,8 @@ asmlinkage __visible void __init __noreturn i386_start_kernel(void) * 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