From patchwork Mon Oct 17 14:53:30 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: 3496 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp1492985wrs; Mon, 17 Oct 2022 07:55:28 -0700 (PDT) X-Google-Smtp-Source: AMsMyM63iH11v1tFQNRywhiFK/tXAhKo9/xCLxkdMUNC0YH3vMK4IYx4SJE/uL3j13JA206wuWDZ X-Received: by 2002:a17:906:5daa:b0:78e:2bc7:f1a3 with SMTP id n10-20020a1709065daa00b0078e2bc7f1a3mr8776002ejv.256.1666018528366; Mon, 17 Oct 2022 07:55:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666018528; cv=none; d=google.com; s=arc-20160816; b=L5J1CI/9O05mlQ0AHSEwAB9fNVTr6RMaR5joLdtcyE7E3sq7YHHpEOjV9F8jdWZVsG j1RhCpJUJxSTt+G0FLGeTqhSfg5zGVvO27F3aHGlKL6tvuXV0zwtJxP5jgWupU47W63o lyb0vafxTU/em/pqpHAUFXKaBvs6ddya9ZyS+W5ybSVzTRTymm0MgBAbjfWlzf8L9TXx ArYdqJqsjTGTXTI+1P9fXt7P+dJo28OLzHn91maj+H7B4zFoFTzOZLO+8gVkZqqwQgd9 ItS9KJEEW97+e7pJlvs7UyPEH4THzTtJ8H/Lu2t4ne5pamfhTaWkRvYJeD7HtYBQ8igf wewQ== 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=a296qv2CVJFJIl0GGF0cDSGCF/VdsmOeIrg0nM5K2WU=; b=RLnrd4eS63gJhM8n+8T0FDO6AaGiWt9K40kNSgMFpWBd3p0Mt/9ASJN6Fmj6OwNQts 1hzTuKKcp57r02eVbAPzQ22gKFt1/9RvYjU+D0O0VDhjpAbLWBzUKgyVCtWds+TocyKs ffM4ofNSchpi11ZyCTJFew6sipsflBL5EmFWqX3X3jjTEKPyRQLsPBusB1piIDKnBLBF UGWTqFqf4+wqToTt9mryP99EVx2E2xZEDQYPs4Y1RQjeBfbLbIoyKD01gNKA4LcEtOHY ZyHIPvBxU+VAsM9YQkjOEttD23JJ+kcBBkRywIfxFwXyoNxeW1ypq906krJ6Ja4IE02N dEiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b="nDZU/czz"; dkim=neutral (no key) header.i=@linutronix.de; 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 nd22-20020a170907629600b0073d8e26e78bsi9291189ejc.960.2022.10.17.07.55.02; Mon, 17 Oct 2022 07:55:28 -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="nDZU/czz"; dkim=neutral (no key) header.i=@linutronix.de; 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 S230368AbiJQOyD (ORCPT + 99 others); Mon, 17 Oct 2022 10:54:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58760 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229949AbiJQOxt (ORCPT ); Mon, 17 Oct 2022 10:53:49 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DA1F667479; Mon, 17 Oct 2022 07:53:34 -0700 (PDT) Date: Mon, 17 Oct 2022 14:53:30 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1666018412; 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=a296qv2CVJFJIl0GGF0cDSGCF/VdsmOeIrg0nM5K2WU=; b=nDZU/czzkLeXHxWyFQX5MEkbTbNo4Cc4Qu0Pq396WN1f7Sj0nopF3VmNbYWWTMlHBwL8he CsC5LrvNHocxHcrZ+ZPbcUq5q6f1P6VBJ7zPv2JB7nsaQglJp12jzMGFtQinxnTkclAzn5 I14SFiauGK9Nt+aamOuVvtZBVBcCUnXsDIjl9xccrXemUvasysHIlvWUzSd7A3YulmnV2H 8Zr40ZUVw8dowLaiz+B51t4hT9e1AUIR90QFiYBCEzUy3iZOPRBU8YZqhrTW4bOFomPd9v bS9NX0M7qkHUdTIR4GsntWaQ8KINzc4RkemQ74hhFklmbyb6pEVg47jdH8PNaw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1666018412; 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=a296qv2CVJFJIl0GGF0cDSGCF/VdsmOeIrg0nM5K2WU=; b=UF6WXlnhTY6gwednPoQJ62KTPLBO9Ufzz2FcSoEGumKekshCUgXTim3UQgPFEDcpPc7376 we3junqjf3X/LPCg== 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/ftrace: Rebalance RSB Cc: "Peter Zijlstra (Intel)" , Thomas Gleixner , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20220915111148.823216933@infradead.org> References: <20220915111148.823216933@infradead.org> MIME-Version: 1.0 Message-ID: <166601841090.401.13594696762736009940.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?1746947044717157731?= X-GMAIL-MSGID: =?utf-8?q?1746947044717157731?= The following commit has been merged into the x86/core branch of tip: Commit-ID: 36b64f101219dd9e6e4f0ea880b64e8a90da547b Gitweb: https://git.kernel.org/tip/36b64f101219dd9e6e4f0ea880b64e8a90da547b Author: Peter Zijlstra AuthorDate: Thu, 15 Sep 2022 13:11:36 +02:00 Committer: Peter Zijlstra CommitterDate: Mon, 17 Oct 2022 16:41:19 +02:00 x86/ftrace: Rebalance RSB ftrace_regs_caller() uses a PUSH;RET pattern to tail-call into a direct-call function, this unbalances the RSB, fix that. Signed-off-by: Peter Zijlstra (Intel) Signed-off-by: Thomas Gleixner Signed-off-by: Peter Zijlstra (Intel) Link: https://lore.kernel.org/r/20220915111148.823216933@infradead.org --- arch/x86/kernel/ftrace_64.S | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/arch/x86/kernel/ftrace_64.S b/arch/x86/kernel/ftrace_64.S index a90c55a..b5b54f5 100644 --- a/arch/x86/kernel/ftrace_64.S +++ b/arch/x86/kernel/ftrace_64.S @@ -271,6 +271,17 @@ SYM_INNER_LABEL(ftrace_regs_caller_end, SYM_L_GLOBAL) /* Restore flags */ popfq UNWIND_HINT_FUNC + + /* + * The above left an extra return value on the stack; effectively + * doing a tail-call without using a register. This PUSH;RET + * pattern unbalances the RSB, inject a pointless CALL to rebalance. + */ + ANNOTATE_INTRA_FUNCTION_CALL + CALL .Ldo_rebalance + int3 +.Ldo_rebalance: + add $8, %rsp RET SYM_FUNC_END(ftrace_regs_caller)