Re: [RFC][PATCH] ftrace/x86: Emulate call function while updating in breakpoint handler

2019-05-01 Thread Peter Zijlstra
On Wed, May 01, 2019 at 09:33:28PM +0200, Jiri Kosina wrote: > On Wed, 1 May 2019, Steven Rostedt wrote: > > > I never tested the 32 bit version of this. And we could just not > > implement it (I don't think there's live kernel patching for it > > either). > > That's correct, there is no livepatc

Re: [RFC][PATCH] ftrace/x86: Emulate call function while updating in breakpoint handler

2019-05-01 Thread Jiri Kosina
On Wed, 1 May 2019, Steven Rostedt wrote: > I never tested the 32 bit version of this. And we could just not > implement it (I don't think there's live kernel patching for it > either). That's correct, there is no livepatching on x86_32 (and no plans for it). CONFIG_LIVEPATCH is not available fo

Re: [RFC][PATCH] ftrace/x86: Emulate call function while updating in breakpoint handler

2019-05-01 Thread Peter Zijlstra
On Wed, May 01, 2019 at 12:03:52PM -0700, Linus Torvalds wrote: > On Wed, May 1, 2019 at 6:11 AM Peter Zijlstra wrote: > > > > Here goes, compile tested only... > > Ugh, two different threads. This has the same bug (same source) as the > one Steven posted: This is what Steve started from; lets c

Re: [RFC][PATCH] ftrace/x86: Emulate call function while updating in breakpoint handler

2019-05-01 Thread Steven Rostedt
On Wed, 1 May 2019 12:03:52 -0700 Linus Torvalds wrote: > On Wed, May 1, 2019 at 6:11 AM Peter Zijlstra wrote: > > > > Here goes, compile tested only... > > Ugh, two different threads. This has the same bug (same source) as the > one Steven posted: > > > --- a/arch/x86/entry/entry_32.S > > +

Re: [RFC][PATCH] ftrace/x86: Emulate call function while updating in breakpoint handler

2019-05-01 Thread Linus Torvalds
On Wed, May 1, 2019 at 6:11 AM Peter Zijlstra wrote: > > Here goes, compile tested only... Ugh, two different threads. This has the same bug (same source) as the one Steven posted: > --- a/arch/x86/entry/entry_32.S > +++ b/arch/x86/entry/entry_32.S > @@ -1479,6 +1479,13 @@ ENTRY(int3) >

Re: [RFC][PATCH] ftrace/x86: Emulate call function while updating in breakpoint handler

2019-05-01 Thread Peter Zijlstra
On Wed, May 01, 2019 at 02:58:24PM -0400, Steven Rostedt wrote: > > + if (ftrace_location(ip)) { > > + int3_emulate_call(regs, ftrace_update_func_call); > > Should be: > > int3_emulate_call(regs, (unsigned long)ftrace_regs_caller); Ah, I lost the plot a little there. >

Re: [RFC][PATCH] ftrace/x86: Emulate call function while updating in breakpoint handler

2019-05-01 Thread Steven Rostedt
On Wed, 1 May 2019 15:11:17 +0200 Peter Zijlstra wrote: > On Tue, Apr 30, 2019 at 11:33:21AM -0700, Linus Torvalds wrote: > > Anyway, since Andy really likes the entry code change, can we have > > that patch in parallel and judge the difference that way? Iirc, that > > was x86-64 specific too.

Re: [RFC][PATCH] ftrace/x86: Emulate call function while updating in breakpoint handler

2019-05-01 Thread Peter Zijlstra
On Tue, Apr 30, 2019 at 11:33:21AM -0700, Linus Torvalds wrote: > Anyway, since Andy really likes the entry code change, can we have > that patch in parallel and judge the difference that way? Iirc, that > was x86-64 specific too. Here goes, compile tested only... It obviously needs a self-test,

Re: [RFC][PATCH] ftrace/x86: Emulate call function while updating in breakpoint handler

2019-04-30 Thread Steven Rostedt
On Tue, 30 Apr 2019 11:33:21 -0700 Linus Torvalds wrote: > > + "ftrace_emulate_call_update_irqoff:\n\t" > > + "push %gs:ftrace_bp_call_return\n\t" > > + "sti\n\t" > > + "jmp *ftrace_update_func_call\n" > > .. and this should then use the "push pu

Re: [RFC][PATCH] ftrace/x86: Emulate call function while updating in breakpoint handler

2019-04-30 Thread Steven Rostedt
On Tue, 30 Apr 2019 11:33:21 -0700 Linus Torvalds wrote: > On Tue, Apr 30, 2019 at 10:49 AM Steven Rostedt wrote: > > > > + > > +asm( > > + ".text\n" > > + > > + /* Trampoline for function update with interrupts enabled */ > > + ".global ftrace_emulate_call_irqoff\n" > > +

Re: [RFC][PATCH] ftrace/x86: Emulate call function while updating in breakpoint handler

2019-04-30 Thread Linus Torvalds
On Tue, Apr 30, 2019 at 10:49 AM Steven Rostedt wrote: > > + > +asm( > + ".text\n" > + > + /* Trampoline for function update with interrupts enabled */ > + ".global ftrace_emulate_call_irqoff\n" > + ".type ftrace_emulate_call_irqoff, @function\n" > + "ftrace_emulate_c

[RFC][PATCH] ftrace/x86: Emulate call function while updating in breakpoint handler

2019-04-30 Thread Steven Rostedt
From: "Steven Rostedt (VMware)" Nicolai Stange discovered[1] that if live kernel patching is enabled, and the function tracer started tracing the same function that was patched, the conversion of the fentry call site during the translation of going from calling the live kernel patch trampoline