On Fri, Jun 07, 2019 at 07:34:27PM +0200, Peter Zijlstra wrote: > On Sat, Jun 08, 2019 at 12:47:08AM +0900, Masami Hiramatsu wrote:
> > > @@ -943,8 +949,21 @@ int poke_int3_handler(struct pt_regs *re > > > if (user_mode(regs) || regs->ip != (unsigned long)bp_int3_addr) > > > return 0; > > > > > > - /* set up the specified breakpoint handler */ > > > - regs->ip = (unsigned long) bp_int3_handler; > > > + opcode = *(struct opcode *)bp_int3_opcode; > > > + > > > + switch (opcode.insn) { > > > + case 0xE8: /* CALL */ > > > + int3_emulate_call(regs, ip + opcode.rel); > > > + break; > > > + > > > + case 0xE9: /* JMP */ > > > + int3_emulate_jmp(regs, ip + opcode.rel); > > > + break; > > > + > > > + default: /* assume NOP */ > > > > Shouldn't we check whether it is actually NOP here? > > 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 > > But maybe we should check for all the various NOP5 variants and BUG() on > anything unexpected. I realized we never actually poke a !ideal nop5_atomic, so I've added that to the latest versions.