From nobody Tue Dec 16 18:33:12 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A97AACD54A9 for ; Tue, 19 Sep 2023 09:54:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231962AbjISJyD (ORCPT ); Tue, 19 Sep 2023 05:54:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36978 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231837AbjISJxV (ORCPT ); Tue, 19 Sep 2023 05:53:21 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 10DD1CD2; Tue, 19 Sep 2023 02:53:15 -0700 (PDT) Date: Tue, 19 Sep 2023 09:53:13 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1695117193; 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=xBMH5cY+WWuS+ewEgw1SpLF0Nkjac+v6iZCL+I4aQrY=; b=UUqm9DvtN4FRP1tTT0uHJcRcMgsuXnITchPKLHWT5a7tav4EaRIyKwJORk8zrb/4IHKnYt T15UFph3L255P69DvlWaAVXz4PZHinLPxZb4T+yToDeeU2Sj62qFZzUl+N2lcmeWvnPV/f zWHrmPvAGU5oZIXhFQirA6t+kIFFkigD7RHzGvvPEIZ0tu946aPdcKaCGDkj2fcTISUmFi n00G053/N6k3FSD5+a95CLse3lb7WLA7atFfhbDSBTSr5klQrlceDit8uqD0sUib7jZ14i tTshSthhvHYfC0T1pAkusUK8eqYwykpqguY12TRqbnELqBMC55bO8C7jmaFfmA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1695117193; 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=xBMH5cY+WWuS+ewEgw1SpLF0Nkjac+v6iZCL+I4aQrY=; b=uLKt8kXzFYyh5hNFWX7O1/2ciL+SFDzgus089txAI0Alcqu3o4hKxjd1WHmHHtrdhEBiPb KwVjCe2urGR+TiCQ== From: "tip-bot2 for Josh Poimboeuf" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/bugs] x86/alternatives: Remove faulty optimization Cc: Josh Poimboeuf , Ingo Molnar , "Borislav Petkov (AMD)" , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <16d19d2249d4485d8380fb215ffaae81e6b8119e.1693889988.git.jpoimboe@kernel.org> References: <16d19d2249d4485d8380fb215ffaae81e6b8119e.1693889988.git.jpoimboe@kernel.org> MIME-Version: 1.0 Message-ID: <169511719305.27769.14807367532070919458.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the x86/bugs branch of tip: Commit-ID: eae1a2bb7dd350195c18f1788f5d687684d8d92d Gitweb: https://git.kernel.org/tip/eae1a2bb7dd350195c18f1788f5d68768= 4d8d92d Author: Josh Poimboeuf AuthorDate: Mon, 04 Sep 2023 22:04:54 -07:00 Committer: Ingo Molnar CommitterDate: Tue, 19 Sep 2023 11:42:47 +02:00 x86/alternatives: Remove faulty optimization The following commit 095b8303f383 ("x86/alternative: Make custom return thunk unconditional") made '__x86_return_thunk' a placeholder value. All code setting X86_FEATURE_RETHUNK also changes the value of 'x86_return_thunk'. So the optimization at the beginning of apply_returns() is dead code. Also, before the above-mentioned commit, the optimization actually had a bug It bypassed __static_call_fixup(), causing some raw returns to remain unpatched in static call trampolines. Thus the 'Fixes' tag. Fixes: d2408e043e72 ("x86/alternative: Optimize returns patching") Signed-off-by: Josh Poimboeuf Signed-off-by: Ingo Molnar Acked-by: Borislav Petkov (AMD) Link: https://lore.kernel.org/r/16d19d2249d4485d8380fb215ffaae81e6b8119e.16= 93889988.git.jpoimboe@kernel.org --- arch/x86/kernel/alternative.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c index a5ead6a..c850f5a 100644 --- a/arch/x86/kernel/alternative.c +++ b/arch/x86/kernel/alternative.c @@ -720,14 +720,6 @@ void __init_or_module noinline apply_returns(s32 *star= t, s32 *end) { s32 *s; =20 - /* - * Do not patch out the default return thunks if those needed are the - * ones generated by the compiler. - */ - if (cpu_feature_enabled(X86_FEATURE_RETHUNK) && - (x86_return_thunk =3D=3D __x86_return_thunk)) - return; - for (s =3D start; s < end; s++) { void *dest =3D NULL, *addr =3D (void *)s + *s; struct insn insn;