x86/alternative: PAUSE is not a NOP
PATCH 1/1 x86/alternative: PAUSE is not a NOP
Subject: x86/alternative: PAUSE is not a NOP
From: Peter Zijlstra <[email protected]>
Date: Wed Jun 14 16:31:35 CEST 2023
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) <[email protected]>
--- arch/x86/kernel/alternative.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
arch/x86/kernel/alternative.c +4 -1
@@ -169,9 +169,12 @@ void text_poke_early(void *addr, const v*/ static bool insn_is_nop (struct insn *insn) { -if (insn->opcode.bytes[0 ] ==0x90 ) +/* Anything NOP, but no REP NOP */ +if (insn->opcode.bytes[0 ] ==0x90 && + (!insn->prefixes.nbytes || insn->prefixes.bytes[0 ] !=0xF3 ))return true; +/* NOPL */ if (insn->opcode.bytes[0 ] ==0x0F && insn->opcode.bytes[1 ] ==0x1F )return true;