From patchwork Wed Nov 2 09:20:02 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: 14158 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp3509310wru; Wed, 2 Nov 2022 02:27:27 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7U84DrU3hv8/bF802O1XA0O8l14dCd7OKlSuVuYkOu7tNB+CVrdL2ol4ZZUPkl/OK4IKBS X-Received: by 2002:a17:907:3e92:b0:7ad:d4f1:11d8 with SMTP id hs18-20020a1709073e9200b007add4f111d8mr13993813ejc.291.1667381247535; Wed, 02 Nov 2022 02:27:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667381247; cv=none; d=google.com; s=arc-20160816; b=nZVLOG0UZV/cllCAQWAMAd6oqn++CYUtVLvHdTnMC9HRhXPNZfy8kjAFN2Dg3L7aA7 Dyl1hTxK21o0r4h2vLx1bO/gVrVuP/oqGQ0/C7XffNqRAxLrLTVFFLVvUp6J9+CToghG RLvqVQZv7mhWY052OYSHDhidoUOBr5+NmqD8pltIjmCebHYx+1QzqYboEQmGATiBhKF8 T4X8s+OJaT/EUjn1E2ju1thEcsZg2btmgCEJ6VsnzDpzmq8vo8H21ZmCtBkWy9J8Bg57 ydzcbGnVqizPwpVwXYfqOjNQPp2mzLoB3JhngsAFkpFpyLNhPhbJRW0KEKcvYd6AzDfN VHkw== 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=8Fs7rx3JLGWegzERC8SiWPfw1n/3JssDfTzRJBvdwY8=; b=LE+pqdR5AEXPpfU5jl/mmRQLMo/hULKdnvKKXNGH+jDovShpDXLqaDCODcizZwyhg5 I41sVJb3OopN0ya/nnof/Co2HoRMtHL7OkJvCv4FU635jq2e7sJPs781Yamxh6C7m9lk Nms4MubDyaIV4g6WlT0OssGhjtu4vMyoxPfDikUpA2QBey7CyAwE0gS6x1fH7bltnX5L U+yZAEV0lUxneTe5zTFj0WcGZeRBC4E1eYk4DMJTeXmPQ650PQZMyc7CYyOZYa1wEi3u /XxT77Hbem7LDDGE3FTKvJshSQysty4+cdHuXEib2RrJg21QnQU9ghQoOC478cV5qijV 2h/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b="dhNDLZ/f"; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=fOeAFzr6; 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 cw13-20020a170906478d00b0076fa1e1274bsi16291928ejc.202.2022.11.02.02.27.03; Wed, 02 Nov 2022 02:27: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="dhNDLZ/f"; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=fOeAFzr6; 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 S231596AbiKBJVv (ORCPT + 99 others); Wed, 2 Nov 2022 05:21:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57534 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231433AbiKBJVT (ORCPT ); Wed, 2 Nov 2022 05:21:19 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9F0C96577; Wed, 2 Nov 2022 02:20:05 -0700 (PDT) Date: Wed, 02 Nov 2022 09:20:02 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1667380804; 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=8Fs7rx3JLGWegzERC8SiWPfw1n/3JssDfTzRJBvdwY8=; b=dhNDLZ/fJro858ZGiKXPzHtrA2hRSjq+qVmhQrXNMt9CJc1nwfa6zR0SIfD+fNRzZd2aEc IyU2UStJxcbj0WRgJ+MONn0SgNOmKCqYVAvonCUfJ/IB1KBM+YMKZ9WpNXQvvY4KQHlg6C Ldw0X+ch9g2bHZDGKT/xxzMSj2L08d3jxtrOYCzTeG1RsXae+Jb/F7JW3XQu4Aqfy5EbfB iSCeuECK+my0iv+u6OtOcEIjEqybFt1EXOCZRC5z1ZEaA727B/QdfBby6Iz00foMxVIBtd ht/igB5kPZdQj/thVq3R1iqfMge1H1S50jnTgXC9ZOPEEnXM5wJVsJRdKj/5og== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1667380804; 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=8Fs7rx3JLGWegzERC8SiWPfw1n/3JssDfTzRJBvdwY8=; b=fOeAFzr6VeoNvEjpHWNF0jhTT4Bf95nQuirUucH0CFJb19il5AkPaaNOlaWk/4rkCPv+m5 T2nYBneacMI0PGCQ== From: "tip-bot2 for Peter Zijlstra" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/core] x86: Add prefix symbols for function padding Cc: "Peter Zijlstra (Intel)" , Yujie Liu , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20221028194453.592512209@infradead.org> References: <20221028194453.592512209@infradead.org> MIME-Version: 1.0 Message-ID: <166738080290.7716.15262986984663902819.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?1747962516634290289?= X-GMAIL-MSGID: =?utf-8?q?1748375959024398841?= The following commit has been merged into the x86/core branch of tip: Commit-ID: b341b20d648bb7e9a3307c33163e7399f0913e66 Gitweb: https://git.kernel.org/tip/b341b20d648bb7e9a3307c33163e7399f0913e66 Author: Peter Zijlstra AuthorDate: Fri, 28 Oct 2022 21:08:19 +02:00 Committer: Peter Zijlstra CommitterDate: Tue, 01 Nov 2022 13:44:09 +01:00 x86: Add prefix symbols for function padding When code is compiled with: -fpatchable-function-entry=${PADDING_BYTES},${PADDING_BYTES} functions will have PADDING_BYTES of NOP in front of them. Unwinders and other things that symbolize code locations will typically attribute these bytes to the preceding function. Given that these bytes nominally belong to the following symbol this mis-attribution is confusing. Inspired by the fact that CFI_CLANG emits __cfi_##name symbols to claim these bytes, use objtool to emit __pfx_##name symbols to do the same when CFI_CLANG is not used. This then shows the callthunk for symbol 'name' as: __pfx_##name+0x6/0x10 Signed-off-by: Peter Zijlstra (Intel) Tested-by: Yujie Liu Link: https://lkml.kernel.org/r/20221028194453.592512209@infradead.org --- arch/x86/Kconfig | 4 ++++ scripts/Makefile.lib | 1 + 2 files changed, 5 insertions(+) diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index b52ad13..32818aa 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -2471,6 +2471,10 @@ config CALL_THUNKS def_bool n select FUNCTION_ALIGNMENT_16B +config PREFIX_SYMBOLS + def_bool y + depends on CALL_THUNKS && !CFI_CLANG + menuconfig SPECULATION_MITIGATIONS bool "Mitigations for speculative execution vulnerabilities" default y diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index 85f0275..2e03bcb 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -265,6 +265,7 @@ objtool-args-$(CONFIG_STACK_VALIDATION) += --stackval objtool-args-$(CONFIG_HAVE_STATIC_CALL_INLINE) += --static-call objtool-args-$(CONFIG_HAVE_UACCESS_VALIDATION) += --uaccess objtool-args-$(CONFIG_GCOV_KERNEL) += --no-unreachable +objtool-args-$(CONFIG_PREFIX_SYMBOLS) += --prefix=$(CONFIG_FUNCTION_PADDING_BYTES) objtool-args = $(objtool-args-y) \ $(if $(delay-objtool), --link) \