Re: [PATCH 08/15] x86/alternatives: Teach text_poke_bp() to emulate instructions
From: Linus Torvalds
Date: Fri Jun 07 2019 - 13:52:42 EST
On Fri, Jun 7, 2019 at 10:34 AM Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:
> I was/am lazy and didn't want to deal with:
> arch/x86/include/asm/nops.h:#define GENERIC_NOP5_ATOMIC NOP_DS_PREFIX,GENERIC_NOP4
> arch/x86/include/asm/nops.h:#define K8_NOP5_ATOMIC 0x66,K8_NOP4
> arch/x86/include/asm/nops.h:#define K7_NOP5_ATOMIC NOP_DS_PREFIX,K7_NOP4
> arch/x86/include/asm/nops.h:#define P6_NOP5_ATOMIC P6_NOP5
Ugh. Maybe we could just pick one atomic sequence, and not have the
magic atomic nops be dynamic.
It's essentially what STATIC_KEY_INIT_NOP #define seems to do anyway.
NOP5_ATOMIC is already special, and not used for the normal nop
rewriting, only for kprobe/jump_label/ftrace.
So I suspect we could just replace all cases of
and get rid of the whole "let's optimize the atomic 5-byte nop" entirely.
By definition, NOP_ATOMIC5 is just a single nop anyway, it's not used
for the potentially more complex alternative rewriting cases.