Re: [PATCH v3 1/6] x86/alternatives: Teach text_poke_bp() to emulate instructions

2019-10-09 Thread Daniel Bristot de Oliveira
On 07/10/2019 10:17, Peter Zijlstra wrote: > In preparation for static_call and variable size jump_label support, > teach text_poke_bp() to emulate instructions, namely: > > JMP32, JMP8, CALL, NOP2, NOP_ATOMIC5, INT3 > > The current text_poke_bp() takes a @handler argument which is used as > a

Re: [PATCH v3 1/6] x86/alternatives: Teach text_poke_bp() to emulate instructions

2019-10-08 Thread Borislav Petkov
On Tue, Oct 08, 2019 at 11:04:12AM -0400, Steven Rostedt wrote: > The difference between do_sync and i is that i gets incremented at > every iteration, where do_sync gets incremented only when the first > conditional is false. But I still see do_sync as a loop variable. I'd prefer it this way:

Re: [PATCH v3 1/6] x86/alternatives: Teach text_poke_bp() to emulate instructions

2019-10-08 Thread Steven Rostedt
On Tue, 8 Oct 2019 16:54:24 +0200 Borislav Petkov wrote: > On Tue, Oct 08, 2019 at 04:48:34PM +0200, Peter Zijlstra wrote: > > Can, but why? That's more lines for no raisin ;-) > > Here's a raisin: I was looking at this and then all of a sudden went: > "W00t, why is this do_sync part of the

Re: [PATCH v3 1/6] x86/alternatives: Teach text_poke_bp() to emulate instructions

2019-10-08 Thread Borislav Petkov
On Tue, Oct 08, 2019 at 04:48:34PM +0200, Peter Zijlstra wrote: > Can, but why? That's more lines for no raisin ;-) Here's a raisin: I was looking at this and then all of a sudden went: "W00t, why is this do_sync part of the loop at all? Do they belong together? Nope." If we're going to save on

Re: [PATCH v3 1/6] x86/alternatives: Teach text_poke_bp() to emulate instructions

2019-10-08 Thread Borislav Petkov
On Tue, Oct 08, 2019 at 10:40:10AM -0400, Steven Rostedt wrote: > Seeing OPCODE_JMP32 and INSN_SIZE_JMP32 doesn't look like they are > related to me. But if it starts with OPCODE_ you know what it is - an opcode. JMP32_INSN_OPCODE can first be shortened to JMP32_OPCODE and then having instruction

Re: [PATCH v3 1/6] x86/alternatives: Teach text_poke_bp() to emulate instructions

2019-10-08 Thread Peter Zijlstra
On Tue, Oct 08, 2019 at 04:29:24PM +0200, Borislav Petkov wrote: > On Mon, Oct 07, 2019 at 10:17:17AM +0200, Peter Zijlstra wrote: > > @@ -63,8 +66,17 @@ static inline void int3_emulate_jmp(stru > > regs->ip = ip; > > } > > > > -#define INT3_INSN_SIZE 1 > > -#define CALL_INSN_SIZE 5 > >

Re: [PATCH v3 1/6] x86/alternatives: Teach text_poke_bp() to emulate instructions

2019-10-08 Thread Steven Rostedt
On Tue, 8 Oct 2019 16:29:24 +0200 Borislav Petkov wrote: > On Mon, Oct 07, 2019 at 10:17:17AM +0200, Peter Zijlstra wrote: > > In preparation for static_call and variable size jump_label support, > > teach text_poke_bp() to emulate instructions, namely: > > > > JMP32, JMP8, CALL, NOP2,

Re: [PATCH v3 1/6] x86/alternatives: Teach text_poke_bp() to emulate instructions

2019-10-08 Thread Borislav Petkov
On Mon, Oct 07, 2019 at 10:17:17AM +0200, Peter Zijlstra wrote: > In preparation for static_call and variable size jump_label support, > teach text_poke_bp() to emulate instructions, namely: > > JMP32, JMP8, CALL, NOP2, NOP_ATOMIC5, INT3 > > The current text_poke_bp() takes a @handler argument

[PATCH v3 1/6] x86/alternatives: Teach text_poke_bp() to emulate instructions

2019-10-07 Thread Peter Zijlstra
In preparation for static_call and variable size jump_label support, teach text_poke_bp() to emulate instructions, namely: JMP32, JMP8, CALL, NOP2, NOP_ATOMIC5, INT3 The current text_poke_bp() takes a @handler argument which is used as a jump target when the temporary INT3 is hit by a