From patchwork Mon Oct 17 14:54:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 3547 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp1494635wrs; Mon, 17 Oct 2022 07:59:27 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5xHP8rWo+G80JzVdLJVnzsKOe6f1CkbKUm2YZGJyo8hPmBdLDWGIVCeDN8y7iYh+uDHtOk X-Received: by 2002:a63:3fce:0:b0:45a:2bab:6002 with SMTP id m197-20020a633fce000000b0045a2bab6002mr11213719pga.454.1666018767085; Mon, 17 Oct 2022 07:59:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666018767; cv=none; d=google.com; s=arc-20160816; b=lCm+kIuYJnr8rVBE/5mq4rNE6+Wu1JiRAw2KQEAEwwec6n0m4wUoAVQNw+r3h1fHr4 EneT2bFOrqBnocBTGCqsIvVOkGjg3c4AC5/ScWwEcQQ6wcjw2hK/u4VrZwayQlXL7+7N qTT3RGKiePb7TWHL94kbZTzQfChyRNU4M/QRym59iAv+LaRltQdsgIv7an/vT2lu8zTE DXs36eM2suJPia5UO7LYsOO4udyoJ1+XgWVwKONxNf7Bpdk60TlspQQqtrYO6AAiOaRO NlNLROp4t8GouJ5ArwPx27oZqmI2ndJMnfri0W9+9hdCJ/x3bPUUMg8cgH1v9DjQfwtj Mbog== 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=3/bMudpa5gTmZ9hfllAlrxNOnF11rbHrfs2Q31WspBQ=; b=s1XPh+LQNHV5xcUlP+BlMXLN3uurK3U5VdOzCsfoLVsZ0Ba4+Ky1lz463P8bmlFhfH hYaRz6MN5PxFM9k3Yf8Z/WLN+D0Zr2uzPff95D109wK/DVXLZPppGGjm1KbHulB7V/+S Mc3qwyV94m8yevN8f2nLsZxj3xDKYG/YN/1HmbLYAy+kAgKV3qm+SM47y3K8hAYxAke3 oAG2dwn70X2hTIaFhLilm6dQAAHBO4gSA/u6Oqwba4pA+r0qjNk51DwYPSgX8LPO/xqz YW7uyuTOFgTovu3MEbiCzJ7ZCZEyFBQK2EKr8iMjbS3Hs6LOc2WhUM3Z4dy3NFMyPDm4 +hnw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=D2EITnlm; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; 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=linutronix.de Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id om6-20020a17090b3a8600b001fd864bec63si19891694pjb.178.2022.10.17.07.59.12; Mon, 17 Oct 2022 07:59:27 -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=@linutronix.de header.s=2020 header.b=D2EITnlm; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; 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=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231465AbiJQO6Y (ORCPT + 99 others); Mon, 17 Oct 2022 10:58:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59684 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231447AbiJQO5M (ORCPT ); Mon, 17 Oct 2022 10:57:12 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AFCB469F45; Mon, 17 Oct 2022 07:54:58 -0700 (PDT) Date: Mon, 17 Oct 2022 14:54:25 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1666018467; 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=3/bMudpa5gTmZ9hfllAlrxNOnF11rbHrfs2Q31WspBQ=; b=D2EITnlmp+ns8u6PL9Gfage+5aCIaEPtDVe9C1Y3JnIdcYTqc5vUJF2whnZMPlIDJwwanA dL+SXuiV9cNeHU2X8SLcAyEUkdf0fF+UlWFYo0gtijWn0WhayXxulJzaKDDt3BSp/YcV3L 0a744ABL8oS3UTmplp4V28T+AOcbNdnxVm0MBNbuSk6kTPvMwEzQT0DABzAo1GWLjPVuZ9 DCm24F00sI8Cz8r8tKbJIAvbFa1a6HLohkne7nZeWw/pwL7zOzfEC4r2/+Te/9SftN+Arx mynxbvlwbold0XXR0oLbGuPhsJTHqWl8sv2dSWuBt0AkAhQBis+b8Dk1FEzmOA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1666018467; 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=3/bMudpa5gTmZ9hfllAlrxNOnF11rbHrfs2Q31WspBQ=; b=tAMEfsX5XopNsQlgwrHLMZpqsOAKe1iqR9mG8Oeg1rg8uNh5SHk8iACc98j7hVFYtABjsX vlOq4hLzWcBbLbAg== From: "tip-bot2 for Thomas Gleixner" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/core] x86: Sanitize linker script Cc: Thomas Gleixner , "Peter Zijlstra (Intel)" , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20220915111143.614728935@infradead.org> References: <20220915111143.614728935@infradead.org> MIME-Version: 1.0 Message-ID: <166601846568.401.9844468920539425423.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,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?1746947294595617077?= X-GMAIL-MSGID: =?utf-8?q?1746947294595617077?= The following commit has been merged into the x86/core branch of tip: Commit-ID: 24a9c543d2114d416f84e386c2fa90089bd97e4c Gitweb: https://git.kernel.org/tip/24a9c543d2114d416f84e386c2fa90089bd97e4c Author: Thomas Gleixner AuthorDate: Thu, 15 Sep 2022 13:10:46 +02:00 Committer: Peter Zijlstra CommitterDate: Mon, 17 Oct 2022 16:40:57 +02:00 x86: Sanitize linker script The section ordering in the text section is more than suboptimal: ALIGN_ENTRY_TEXT_BEGIN ENTRY_TEXT ALIGN_ENTRY_TEXT_END SOFTIRQENTRY_TEXT STATIC_CALL_TEXT INDIRECT_THUNK_TEXT ENTRY_TEXT is in a seperate PMD so it can be mapped into the cpu entry area when KPTI is enabled. That means the sections after it are also in a seperate PMD. That's wasteful especially as the indirect thunk text is a hotpath on retpoline enabled systems and the static call text is fairly hot on 32bit. Move the entry text section last so that the other sections share a PMD with the text before it. This is obviously just best effort and not guaranteed when the previous text is just at a PMD boundary. The text section placement needs an overhaul in general. There is e.g. no point to have debugfs, sysfs, cpuhotplug and other rarely used functions next to hot path text. Signed-off-by: Thomas Gleixner Signed-off-by: Peter Zijlstra (Intel) Link: https://lore.kernel.org/r/20220915111143.614728935@infradead.org --- arch/x86/kernel/vmlinux.lds.S | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/arch/x86/kernel/vmlinux.lds.S b/arch/x86/kernel/vmlinux.lds.S index 15f2905..0e9fc08 100644 --- a/arch/x86/kernel/vmlinux.lds.S +++ b/arch/x86/kernel/vmlinux.lds.S @@ -132,18 +132,19 @@ SECTIONS CPUIDLE_TEXT LOCK_TEXT KPROBES_TEXT - ALIGN_ENTRY_TEXT_BEGIN - ENTRY_TEXT - ALIGN_ENTRY_TEXT_END SOFTIRQENTRY_TEXT - STATIC_CALL_TEXT - *(.gnu.warning) - #ifdef CONFIG_RETPOLINE __indirect_thunk_start = .; *(.text.__x86.*) __indirect_thunk_end = .; #endif + STATIC_CALL_TEXT + + ALIGN_ENTRY_TEXT_BEGIN + ENTRY_TEXT + ALIGN_ENTRY_TEXT_END + *(.gnu.warning) + } :text =0xcccc /* End of text section, which should occupy whole number of pages */