From nobody Wed Dec 17 00:00:18 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 1B340C3DA6F for ; Fri, 25 Aug 2023 10:28:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239119AbjHYK2E (ORCPT ); Fri, 25 Aug 2023 06:28:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55550 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242594AbjHYK1i (ORCPT ); Fri, 25 Aug 2023 06:27:38 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A0DE7173F; Fri, 25 Aug 2023 03:27:28 -0700 (PDT) Date: Fri, 25 Aug 2023 10:27:26 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1692959247; 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=YzG3RW39iHPjZevebhUl2UVYuB9XekH8MFQMxrCTkQE=; b=NjGtFGOMKkrOIj9FLwAF/hQa5jZvonf6bjBwGtwhaPSh38Q9xuhZlYfgLBJu9M1hcze/Nw A/EQVCnDqNE7O1dkRV/eFjphy6gx9YsIascUwpkarnnFfaLuofar2ajJTI8mRsE4ctNVsJ UvaRjKV0gc3hSnbTYB32/nsHs1rjKy4B2T2AfuMbTmiUJt7sUkQpfAirnV+VctBIwlcVmT uFDny+yt5JyO0gpyUSKDk59D05ZLmzjTLmZF7swk3e+Mokqq5aCifT0gJIzTItk1Bs5qpY 34CiY1IlcHL/OB5L7493cdeyv2xJmzca8kepOxCFAdLoAUgEaepcrFYL1ZMKcw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1692959247; 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=YzG3RW39iHPjZevebhUl2UVYuB9XekH8MFQMxrCTkQE=; b=aV6eSHGpL1ndBIQ9pwdP758ft7klflqGazuBj1XD+WFVuI+UeXotbEkgI3brcTzyPp7EB2 2X3NkvADxwjQbHDg== 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/urgent] x86/alternatives: Remove faulty optimization Cc: Josh Poimboeuf , Ingo Molnar , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: References: MIME-Version: 1.0 Message-ID: <169295924656.27769.16676733807587237109.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/urgent branch of tip: Commit-ID: 71cb8d530bfa25abe4c1b9f67c4a24dc6c61e9b0 Gitweb: https://git.kernel.org/tip/71cb8d530bfa25abe4c1b9f67c4a24dc6= c61e9b0 Author: Josh Poimboeuf AuthorDate: Fri, 25 Aug 2023 00:01:43 -07:00 Committer: Ingo Molnar CommitterDate: Fri, 25 Aug 2023 12:22:04 +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 Link: https://lore.kernel.org/r/ca76a2e94217d6fc8e007d2ca79fee219f3168f8.16= 92919072.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 099d58d..34be5fb 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;