Re: [PATCH v4 1/2] x86/unwind: add ORC unwinder

2017-09-28 Thread Juergen Gross
On 28/09/17 15:55, Josh Poimboeuf wrote: > On Thu, Sep 28, 2017 at 08:03:26AM +0200, Juergen Gross wrote: >> On 27/09/17 23:08, Josh Poimboeuf wrote: >>> On Tue, Aug 08, 2017 at 01:09:08PM -0700, Andy Lutomirski wrote: On Tue, Aug 8, 2017 at 12:13 PM, Josh Poimboeuf wrote: > On Tue,

Re: [PATCH v4 1/2] x86/unwind: add ORC unwinder

2017-09-28 Thread Josh Poimboeuf
On Thu, Sep 28, 2017 at 08:03:26AM +0200, Juergen Gross wrote: > On 27/09/17 23:08, Josh Poimboeuf wrote: > > On Tue, Aug 08, 2017 at 01:09:08PM -0700, Andy Lutomirski wrote: > >> On Tue, Aug 8, 2017 at 12:13 PM, Josh Poimboeuf > >> wrote: > >>> On Tue, Aug 08, 2017 at 12:03:51PM -0700, Linus Tor

Re: [PATCH v4 1/2] x86/unwind: add ORC unwinder

2017-09-27 Thread Juergen Gross
On 27/09/17 23:08, Josh Poimboeuf wrote: > On Tue, Aug 08, 2017 at 01:09:08PM -0700, Andy Lutomirski wrote: >> On Tue, Aug 8, 2017 at 12:13 PM, Josh Poimboeuf wrote: >>> On Tue, Aug 08, 2017 at 12:03:51PM -0700, Linus Torvalds wrote: On Tue, Aug 8, 2017 at 11:58 AM, Josh Poimboeuf wrot

Re: [PATCH v4 1/2] x86/unwind: add ORC unwinder

2017-09-27 Thread Josh Poimboeuf
On Tue, Aug 08, 2017 at 01:09:08PM -0700, Andy Lutomirski wrote: > On Tue, Aug 8, 2017 at 12:13 PM, Josh Poimboeuf wrote: > > On Tue, Aug 08, 2017 at 12:03:51PM -0700, Linus Torvalds wrote: > >> On Tue, Aug 8, 2017 at 11:58 AM, Josh Poimboeuf > >> wrote: > >> > > >> > Take for example the lock_i

Re: [PATCH v4 1/2] x86/unwind: add ORC unwinder

2017-08-10 Thread Josh Poimboeuf
On Thu, Aug 10, 2017 at 04:59:36PM +0200, Juergen Gross wrote: > On 10/08/17 16:39, Josh Poimboeuf wrote: > > On Thu, Aug 10, 2017 at 04:24:58PM +0200, Juergen Gross wrote: > I'll send some patches to: > > - remove xen_patch() > - remove lguest > - remove vsmp > >

Re: [PATCH v4 1/2] x86/unwind: add ORC unwinder

2017-08-10 Thread Juergen Gross
On 10/08/17 16:39, Josh Poimboeuf wrote: > On Thu, Aug 10, 2017 at 04:24:58PM +0200, Juergen Gross wrote: I'll send some patches to: - remove xen_patch() - remove lguest - remove vsmp In case nobody objects to apply those patches we can possibly simplify some

Re: [PATCH v4 1/2] x86/unwind: add ORC unwinder

2017-08-10 Thread Josh Poimboeuf
On Thu, Aug 10, 2017 at 09:09:03AM -0500, Josh Poimboeuf wrote: > static inline notrace unsigned long arch_local_save_flags(void) > { > return PVOP_CALLEE0(unsigned long, pv_irq_ops.save_fl, > "pushfq; popq %rax", CPU_FEATURE_NATIVE, > "call

Re: [PATCH v4 1/2] x86/unwind: add ORC unwinder

2017-08-10 Thread Josh Poimboeuf
On Thu, Aug 10, 2017 at 04:24:58PM +0200, Juergen Gross wrote: > >> I'll send some patches to: > >> > >> - remove xen_patch() > >> - remove lguest > >> - remove vsmp > >> > >> In case nobody objects to apply those patches we can possibly simplify > >> some more code. > >> > >> I'd love that. :-) >

Re: [PATCH v4 1/2] x86/unwind: add ORC unwinder

2017-08-10 Thread Juergen Gross
On 10/08/17 16:09, Josh Poimboeuf wrote: > On Thu, Aug 10, 2017 at 09:05:19AM +0200, Juergen Gross wrote: >>> I'm wondering why xen_patch() even exists. The main difference between >>> xen_patch() and native_patch() seems to be that xen_patch() does some >>> relocs when doing an inline patch after

Re: [PATCH v4 1/2] x86/unwind: add ORC unwinder

2017-08-10 Thread Josh Poimboeuf
On Thu, Aug 10, 2017 at 09:05:19AM +0200, Juergen Gross wrote: > > I'm wondering why xen_patch() even exists. The main difference between > > xen_patch() and native_patch() seems to be that xen_patch() does some > > relocs when doing an inline patch after calling paravirt_patch_insns(). > > > > B

Re: [PATCH v4 1/2] x86/unwind: add ORC unwinder

2017-08-10 Thread Juergen Gross
On 09/08/17 22:15, Josh Poimboeuf wrote: > On Wed, Aug 09, 2017 at 11:55:35AM +0200, Juergen Gross wrote: >> On 09/08/17 11:35, Peter Zijlstra wrote: >>> On Wed, Aug 09, 2017 at 11:24:07AM +0200, Juergen Gross wrote: On 09/08/17 11:16, Peter Zijlstra wrote: > On Wed, Aug 09, 2017 at 10:49:

Re: [PATCH v4 1/2] x86/unwind: add ORC unwinder

2017-08-09 Thread Josh Poimboeuf
On Wed, Aug 09, 2017 at 11:55:35AM +0200, Juergen Gross wrote: > On 09/08/17 11:35, Peter Zijlstra wrote: > > On Wed, Aug 09, 2017 at 11:24:07AM +0200, Juergen Gross wrote: > >> On 09/08/17 11:16, Peter Zijlstra wrote: > >>> On Wed, Aug 09, 2017 at 10:49:43AM +0200, Juergen Gross wrote: > > ALT

Re: [PATCH v4 1/2] x86/unwind: add ORC unwinder

2017-08-09 Thread Juergen Gross
On 09/08/17 18:11, Andy Lutomirski wrote: > On Wed, Aug 9, 2017 at 1:49 AM, Juergen Gross wrote: >> On 08/08/17 22:09, Andy Lutomirski wrote: >>> On Tue, Aug 8, 2017 at 12:13 PM, Josh Poimboeuf wrote: On Tue, Aug 08, 2017 at 12:03:51PM -0700, Linus Torvalds wrote: > On Tue, Aug 8, 2017 a

Re: [PATCH v4 1/2] x86/unwind: add ORC unwinder

2017-08-09 Thread Andy Lutomirski
On Wed, Aug 9, 2017 at 1:49 AM, Juergen Gross wrote: > On 08/08/17 22:09, Andy Lutomirski wrote: >> On Tue, Aug 8, 2017 at 12:13 PM, Josh Poimboeuf wrote: >>> On Tue, Aug 08, 2017 at 12:03:51PM -0700, Linus Torvalds wrote: On Tue, Aug 8, 2017 at 11:58 AM, Josh Poimboeuf wrote: > >

Re: [PATCH v4 1/2] x86/unwind: add ORC unwinder

2017-08-09 Thread Juergen Gross
On 09/08/17 11:35, Peter Zijlstra wrote: > On Wed, Aug 09, 2017 at 11:24:07AM +0200, Juergen Gross wrote: >> On 09/08/17 11:16, Peter Zijlstra wrote: >>> On Wed, Aug 09, 2017 at 10:49:43AM +0200, Juergen Gross wrote: > ALTERNATIVE "pushfq; popq %rax", "callq *pv_irq_ops.save_fl", > X86_FEAT

Re: [PATCH v4 1/2] x86/unwind: add ORC unwinder

2017-08-09 Thread Peter Zijlstra
On Wed, Aug 09, 2017 at 11:24:07AM +0200, Juergen Gross wrote: > On 09/08/17 11:16, Peter Zijlstra wrote: > > On Wed, Aug 09, 2017 at 10:49:43AM +0200, Juergen Gross wrote: > >>> ALTERNATIVE "pushfq; popq %rax", "callq *pv_irq_ops.save_fl", > >>> X86_FEATURE_GODDAMN_PV_IRQ_OPS > >> > >> You are awa

Re: [PATCH v4 1/2] x86/unwind: add ORC unwinder

2017-08-09 Thread Juergen Gross
On 09/08/17 11:16, Peter Zijlstra wrote: > On Wed, Aug 09, 2017 at 10:49:43AM +0200, Juergen Gross wrote: >>> ALTERNATIVE "pushfq; popq %rax", "callq *pv_irq_ops.save_fl", >>> X86_FEATURE_GODDAMN_PV_IRQ_OPS >> >> You are aware that at least some of the Xen irq pvops functionality is >> patched inli

Re: [PATCH v4 1/2] x86/unwind: add ORC unwinder

2017-08-09 Thread Peter Zijlstra
On Wed, Aug 09, 2017 at 10:49:43AM +0200, Juergen Gross wrote: > > ALTERNATIVE "pushfq; popq %rax", "callq *pv_irq_ops.save_fl", > > X86_FEATURE_GODDAMN_PV_IRQ_OPS > > You are aware that at least some of the Xen irq pvops functionality is > patched inline? Your modification would slow down pv gues

Re: [PATCH v4 1/2] x86/unwind: add ORC unwinder

2017-08-09 Thread Juergen Gross
On 08/08/17 22:09, Andy Lutomirski wrote: > On Tue, Aug 8, 2017 at 12:13 PM, Josh Poimboeuf wrote: >> On Tue, Aug 08, 2017 at 12:03:51PM -0700, Linus Torvalds wrote: >>> On Tue, Aug 8, 2017 at 11:58 AM, Josh Poimboeuf wrote: Take for example the lock_is_held_type() function. In vmlinux

Re: [PATCH v4 1/2] x86/unwind: add ORC unwinder

2017-08-08 Thread Josh Poimboeuf
On Tue, Aug 08, 2017 at 01:09:08PM -0700, Andy Lutomirski wrote: > >> c) just add ORC data for the alternative statically and _unconditionally_. > >> > >> No runtime registration. Just an unconditional entry for the > >> particular IP that comes after the "pushfq". It cannot match the > >> "callq"

Re: [PATCH v4 1/2] x86/unwind: add ORC unwinder

2017-08-08 Thread Andy Lutomirski
On Tue, Aug 8, 2017 at 12:13 PM, Josh Poimboeuf wrote: > On Tue, Aug 08, 2017 at 12:03:51PM -0700, Linus Torvalds wrote: >> On Tue, Aug 8, 2017 at 11:58 AM, Josh Poimboeuf wrote: >> > >> > Take for example the lock_is_held_type() function. In vmlinux, it has >> > the following instruction: >> >

Re: [PATCH v4 1/2] x86/unwind: add ORC unwinder

2017-08-08 Thread Josh Poimboeuf
On Tue, Aug 08, 2017 at 12:03:51PM -0700, Linus Torvalds wrote: > On Tue, Aug 8, 2017 at 11:58 AM, Josh Poimboeuf wrote: > > > > Take for example the lock_is_held_type() function. In vmlinux, it has > > the following instruction: > > > > callq *0x85a94880 (pv_irq_ops.save_fl) > > > > At

Re: [PATCH v4 1/2] x86/unwind: add ORC unwinder

2017-08-08 Thread Linus Torvalds
On Tue, Aug 8, 2017 at 11:58 AM, Josh Poimboeuf wrote: > > Take for example the lock_is_held_type() function. In vmlinux, it has > the following instruction: > > callq *0x85a94880 (pv_irq_ops.save_fl) > > At runtime, that instruction is patched and replaced with a fast inline > version

Re: [PATCH v4 1/2] x86/unwind: add ORC unwinder

2017-08-08 Thread Josh Poimboeuf
On Fri, Jul 28, 2017 at 10:54:37PM -0500, Josh Poimboeuf wrote: > On Fri, Jul 28, 2017 at 07:59:12PM +, Levin, Alexander (Sasha Levin) > wrote: > > On Fri, Jul 28, 2017 at 01:57:20PM -0500, Josh Poimboeuf wrote: > > >Thanks, that's much better. I'm relieved the unwinder didn't screw that > >

Re: [PATCH v4 1/2] x86/unwind: add ORC unwinder

2017-07-28 Thread Josh Poimboeuf
On Fri, Jul 28, 2017 at 07:59:12PM +, Levin, Alexander (Sasha Levin) wrote: > On Fri, Jul 28, 2017 at 01:57:20PM -0500, Josh Poimboeuf wrote: > >Thanks, that's much better. I'm relieved the unwinder didn't screw that > >up, at least. > > > >This looks like a tricky one. Is it easily recreatab

Re: [PATCH v4 1/2] x86/unwind: add ORC unwinder

2017-07-28 Thread Levin, Alexander (Sasha Levin)
On Fri, Jul 28, 2017 at 01:57:20PM -0500, Josh Poimboeuf wrote: >Thanks, that's much better. I'm relieved the unwinder didn't screw that >up, at least. > >This looks like a tricky one. Is it easily recreatable? Yeah, I just hit it again with slightly different initial calls: [ 49.261152] ===

Re: [PATCH v4 1/2] x86/unwind: add ORC unwinder

2017-07-28 Thread Josh Poimboeuf
On Fri, Jul 28, 2017 at 06:29:57PM +, Levin, Alexander (Sasha Levin) wrote: > On Fri, Jul 28, 2017 at 12:52:34PM -0500, Josh Poimboeuf wrote: > >On Fri, Jul 28, 2017 at 04:48:47PM +, Levin, Alexander (Sasha Levin) > >wrote: > >> Hey Josh, > >> > >> Syzkaller seems to trigger the following:

Re: [PATCH v4 1/2] x86/unwind: add ORC unwinder

2017-07-28 Thread Levin, Alexander (Sasha Levin)
On Fri, Jul 28, 2017 at 12:52:34PM -0500, Josh Poimboeuf wrote: >On Fri, Jul 28, 2017 at 04:48:47PM +, Levin, Alexander (Sasha Levin) wrote: >> Hey Josh, >> >> Syzkaller seems to trigger the following: >> >> == >> BUG: KASAN: stack

Re: [PATCH v4 1/2] x86/unwind: add ORC unwinder

2017-07-28 Thread Josh Poimboeuf
On Fri, Jul 28, 2017 at 04:48:47PM +, Levin, Alexander (Sasha Levin) wrote: > Hey Josh, > > Syzkaller seems to trigger the following: > > == > BUG: KASAN: stack-out-of-bounds in __read_once_size > include/linux/compiler.h:253 [i

Re: [PATCH v4 1/2] x86/unwind: add ORC unwinder

2017-07-28 Thread Levin, Alexander (Sasha Levin)
On Mon, Jul 24, 2017 at 06:36:57PM -0500, Josh Poimboeuf wrote: >Add a new ORC unwinder which is enabled by CONFIG_ORC_UNWINDER. It >plugs into the existing x86 unwinder framework. > >It relies on objtool to generate the needed .orc_unwind and >.orc_unwind_ip sections. > >For more details on why O