From nobody Sat Feb 7 08:45:33 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 9D758EB64DB for ; Wed, 14 Jun 2023 17:43:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239093AbjFNRnC (ORCPT ); Wed, 14 Jun 2023 13:43:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56240 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237525AbjFNRm6 (ORCPT ); Wed, 14 Jun 2023 13:42:58 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A22CE1BF0; Wed, 14 Jun 2023 10:42:57 -0700 (PDT) Date: Wed, 14 Jun 2023 17:42:54 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1686764575; 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; bh=hfkqaiey4eDp8QZH5LR5I91Mf3eI8gRoHf9KYFgCwTM=; b=p2UvlN3pOnWAt8bO2PQHu4MCkuWYzG5/L5PsA+XTlrWVmWPUVkBpSZCFmpR8T2fXJ6dY4q pKXfrCpi8OH1vN3f/nrnITSFkVp3GmxhlBOJv6ujXvd7wNbv0YrqCRMt9rYwJKazC6cVnk 5jqjGQmn9B/I6xP5apC+s4VbRrEUj/qKq45sbykrdGtbTJ2xrJimtwnnkzr42QVID0qN1t SF9PPO5OBFahSE3TBUsPGn2YwPvYTMkgnvCks1knmgpafsE4tnw+Bzcm4hq+E4aYcyp/So opJRfamE6fjMvYFaZgCgvywCOhLjrLfaovG3fkoZ0impVL204cPqLfWSeLyumQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1686764575; 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; bh=hfkqaiey4eDp8QZH5LR5I91Mf3eI8gRoHf9KYFgCwTM=; b=VUIyuFVu+aw2Zf5NuWRLRt/gHhj3bmuCIqL7B0aDU1QbOPmy4f/wk3Z5SkI/eAmf0beF8k 5E2t5j6i4jzWKEDA== 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/alternatives] x86/alternative: PAUSE is not a NOP Cc: "Peter Zijlstra (Intel)" , "Borislav Petkov (AMD)" , x86@kernel.org, linux-kernel@vger.kernel.org MIME-Version: 1.0 Message-ID: <168676457432.404.2368644491901077612.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/alternatives branch of ti= p: Commit-ID: 2bd4aa9325821551648cf9738d6aa3a49317d7e5 Gitweb: https://git.kernel.org/tip/2bd4aa9325821551648cf9738d6aa3a49= 317d7e5 Author: Peter Zijlstra AuthorDate: Wed, 14 Jun 2023 16:35:50 +02:00 Committer: Borislav Petkov (AMD) CommitterDate: Wed, 14 Jun 2023 19:02:54 +02:00 x86/alternative: PAUSE is not a NOP While chasing ghosts, I did notice that optimize_nops() was replacing 'REP NOP' aka 'PAUSE' with NOP2. This is clearly not right. Fixes: 6c480f222128 ("x86/alternative: Rewrite optimize_nops() some") Signed-off-by: Peter Zijlstra (Intel) Signed-off-by: Borislav Petkov (AMD) Link: https://lore.kernel.org/linux-next/20230524130104.GR83892@hirez.progr= amming.kicks-ass.net/ --- arch/x86/kernel/alternative.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c index bbfbf7a..a7e1ec5 100644 --- a/arch/x86/kernel/alternative.c +++ b/arch/x86/kernel/alternative.c @@ -169,9 +169,12 @@ void text_poke_early(void *addr, const void *opcode, s= ize_t len); */ static bool insn_is_nop(struct insn *insn) { - if (insn->opcode.bytes[0] =3D=3D 0x90) + /* Anything NOP, but no REP NOP */ + if (insn->opcode.bytes[0] =3D=3D 0x90 && + (!insn->prefixes.nbytes || insn->prefixes.bytes[0] !=3D 0xF3)) return true; =20 + /* NOPL */ if (insn->opcode.bytes[0] =3D=3D 0x0F && insn->opcode.bytes[1] =3D=3D 0x1= F) return true;