Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp749138rwd; Tue, 16 May 2023 07:18:13 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4GiNUFvxgwGerzLis6n3ua6fmqlUv76b+jfLcw8tehSPG5/SH/1RO4PNq/oZTeYgFwCdIC X-Received: by 2002:a17:903:230d:b0:1ad:164:74fc with SMTP id d13-20020a170903230d00b001ad016474fcmr26902193plh.20.1684246693022; Tue, 16 May 2023 07:18:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684246693; cv=none; d=google.com; s=arc-20160816; b=daaor+/x8QivCpM0J4cKU6/fqW7MqcY+tSBGHiZruv0hmdUooVNanYs2lhJdDsVdui DN1bIHjdAIDlbgtsQui+rSCv/9Q4AaPbQaso4aJiJkiKHEVXLD5luTTr0QiO3caQb38L pG31HXn60BDCNfBlmL5gof6Wg0AD4CW186arMAMTE0AaM6D5N1gZfdT7BH6ilUopCXeP s3rFSGHgN/6po0Hj74MJaEHb/u+LTpIJKDuztv6wPIIm8TeFKlSwCciAfUTGafn7QzyR Yx8qrhJ1RScEhP1mtkR4m8M95IEUSHzQtUCq4y8/bYZyzvNTBHuB3xdy2S/mBV16jrTi Ss8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=hQ3EPbiV+nJWVHTV23MnUIsgc33EdU1guTY5b9ihdBA=; b=mNj+kswUuWPTLxxWKQyTbHMCniZsiTkrT0AHQXfKWXg7fFY2CYzhK2cVz1XfeazsEK BxWoXKGDGFDzhEOIH0zJNoBIrM8MizviWIlllzuvnTMTCqaYum4QV7sIRk6ZFzm2lSST NTZFPwrKMSCTu8rpYcoZ8rMcQV7aFnCEiapKLSchk1UvKwbALlzFNLjtN9cgkdCsPzZq CIvwzjTRK+Er5FOTySodnoUzLbp4/DsYI6Zzy08no7h/4XpMm1IiG9XoPDwJzHVUK8a6 kuhd5hW54qK9BjZaPcQP4EKAnxfZ3yUzqL8+nX33pPnshjmDSmN0lCN6DPfV6NJTZV3y RpHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=OfwUrj6G; 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=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q12-20020a17090311cc00b001aafc97feb0si6222704plh.174.2023.05.16.07.17.59; Tue, 16 May 2023 07:18:13 -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=@kernel.org header.s=k20201202 header.b=OfwUrj6G; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233427AbjEPN5N (ORCPT + 99 others); Tue, 16 May 2023 09:57:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39950 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232324AbjEPN5L (ORCPT ); Tue, 16 May 2023 09:57:11 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CE3C71711 for ; Tue, 16 May 2023 06:57:10 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 62B7E6168D for ; Tue, 16 May 2023 13:57:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 979DBC433D2; Tue, 16 May 2023 13:57:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1684245429; bh=Dg6xwqAYoBbJ+/6rCpEbcwJd7iha1URjRnlvLQywWho=; h=From:To:Cc:Subject:Date:From; b=OfwUrj6GRuK7IpN+1ySxaWFi+FLMIldsaeFzydc+4ar2z8xmew09zdNiWgavN7UgD Lupr7WbGFXNXxdxGhvK1lCIvM6aZO9UWE2mMKhP3zeJ5B+6itQPVrKnr7TWkSiE1k5 CZx2QDsC99s3Zw6En+AtfQ2XaFMNbVq5KFJ3uK37jNjzGooczBSdZvexxp0h+53cBe 9xJ3OMaPzwSj7RxDzhvXKpSOY5xij3uH/vVpiQ6exdyHxivZfFePfCR3nUeLcT1ixK Y10Jm7Am0/HX8t30ikVogZgudCIqqZkT61U4LU+gjma0WEHbH6MJ7qdPczpSFc6ssU vLpKolMZSw9GQ== From: Josh Poimboeuf To: x86@kernel.org Cc: linux-kernel@vger.kernel.org, Peter Zijlstra , Thomas Gleixner Subject: [PATCH] Revert "x86/orc: Make it callthunk aware" Date: Tue, 16 May 2023 06:56:46 -0700 Message-Id: X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 Commit 396e0b8e09e8 ("x86/orc: Make it callthunk aware") attempted to deal with the fact that function prefix code didn't have ORC coverage. However, it didn't work as advertised. Use of the "null" ORC entry just caused affected unwinds to end early. The root cause has now been fixed with commit 5743654f5e2e ("objtool: Generate ORC data for __pfx code"). Revert most of commit 396e0b8e09e8 ("x86/orc: Make it callthunk aware"). The is_callthunk() function remains as it's now used by other code. Signed-off-by: Josh Poimboeuf --- arch/x86/include/asm/alternative.h | 5 ----- arch/x86/kernel/callthunks.c | 2 +- arch/x86/kernel/unwind_orc.c | 21 +-------------------- 3 files changed, 2 insertions(+), 26 deletions(-) diff --git a/arch/x86/include/asm/alternative.h b/arch/x86/include/asm/alternative.h index d7da28fada87..6c15a622ad60 100644 --- a/arch/x86/include/asm/alternative.h +++ b/arch/x86/include/asm/alternative.h @@ -113,7 +113,6 @@ extern void callthunks_patch_builtin_calls(void); extern void callthunks_patch_module_calls(struct callthunk_sites *sites, struct module *mod); extern void *callthunks_translate_call_dest(void *dest); -extern bool is_callthunk(void *addr); extern int x86_call_depth_emit_accounting(u8 **pprog, void *func); #else static __always_inline void callthunks_patch_builtin_calls(void) {} @@ -124,10 +123,6 @@ static __always_inline void *callthunks_translate_call_dest(void *dest) { return dest; } -static __always_inline bool is_callthunk(void *addr) -{ - return false; -} static __always_inline int x86_call_depth_emit_accounting(u8 **pprog, void *func) { diff --git a/arch/x86/kernel/callthunks.c b/arch/x86/kernel/callthunks.c index 22ab13966427..8e0a9b637e23 100644 --- a/arch/x86/kernel/callthunks.c +++ b/arch/x86/kernel/callthunks.c @@ -293,7 +293,7 @@ void *callthunks_translate_call_dest(void *dest) return target ? : dest; } -bool is_callthunk(void *addr) +static bool is_callthunk(void *addr) { unsigned int tmpl_size = SKL_TMPL_SIZE; void *tmpl = skl_call_thunk_template; diff --git a/arch/x86/kernel/unwind_orc.c b/arch/x86/kernel/unwind_orc.c index 3ac50b7298d1..183bc20f610e 100644 --- a/arch/x86/kernel/unwind_orc.c +++ b/arch/x86/kernel/unwind_orc.c @@ -136,21 +136,6 @@ static struct orc_entry null_orc_entry = { .type = ORC_TYPE_CALL }; -#ifdef CONFIG_CALL_THUNKS -static struct orc_entry *orc_callthunk_find(unsigned long ip) -{ - if (!is_callthunk((void *)ip)) - return NULL; - - return &null_orc_entry; -} -#else -static struct orc_entry *orc_callthunk_find(unsigned long ip) -{ - return NULL; -} -#endif - /* Fake frame pointer entry -- used as a fallback for generated code */ static struct orc_entry orc_fp_entry = { .type = ORC_TYPE_CALL, @@ -203,11 +188,7 @@ static struct orc_entry *orc_find(unsigned long ip) if (orc) return orc; - orc = orc_ftrace_find(ip); - if (orc) - return orc; - - return orc_callthunk_find(ip); + return orc_ftrace_find(ip); } #ifdef CONFIG_MODULES -- 2.40.1