From nobody Tue Feb 10 05:27:06 2026 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 3FFC7CA0FE2 for ; Tue, 5 Sep 2023 16:33:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353846AbjIEQdo (ORCPT ); Tue, 5 Sep 2023 12:33:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51840 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354199AbjIEKJm (ORCPT ); Tue, 5 Sep 2023 06:09:42 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C394790; Tue, 5 Sep 2023 03:09:38 -0700 (PDT) Date: Tue, 05 Sep 2023 10:09:36 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1693908577; 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=a/ZBUw3hrZJKpFt2lnhrf6RzSSsgTyMINUg8yzTgPyI=; b=KH5wN028sx7dwbfzAqPSPk4S3Kc8Nv5IHhKAjfpBZAOW0X49POlrREiibRv/GU8oJ947kn Q93/IvAHnXlgfIsymVuxeO8TJMNX7lbF5J5uW2bKsBW33L+hCVw+wQVrquQP+HP3cbuGol Lep5rfsVJlaxiImxH1oZqRDXOtCdEUN2ctDUhNzqewvKu6xrngYgIMhjhu+xlxJ9H3R7+c T8NpNbrCPm3gpCv+gDZ2SJntljDMfUiEoYO/YN6LZWjSoxMYHap5ssfP2vJ7nObF/FBNjT JC2hq0zpqkn9zxg1ipuVEOpxjrADHpAJ2Ql/cwB1bTWLUvalHX+41X3yVSTUag== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1693908577; 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=a/ZBUw3hrZJKpFt2lnhrf6RzSSsgTyMINUg8yzTgPyI=; b=dKH0Zt8L7MD0DfAlhIVOpm7+YkCyEXYAjy8zqQbO36y9GbyFjTj9Q3PsI/z1gkybeKPEf7 59lFwKeTbq4TWrAw== 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: <169390857696.27769.15598358510708203877.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: 85d5fbfb7deaf3a5b4666e741bb72a68866439e6 Gitweb: https://git.kernel.org/tip/85d5fbfb7deaf3a5b4666e741bb72a688= 66439e6 Author: Josh Poimboeuf AuthorDate: Mon, 04 Sep 2023 22:04:54 -07:00 Committer: Ingo Molnar CommitterDate: Tue, 05 Sep 2023 12:05:07 +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;