Re: [PATCH v2 10/14] x86/extable: Adjust extable handling to be shadow stack compatible

2020-06-02 Thread Jan Beulich
On 29.05.2020 23:17, Andrew Cooper wrote: > On 29/05/2020 20:43, Andrew Cooper wrote: >> On 28/05/2020 17:15, Jan Beulich wrote: >>> On 27.05.2020 21:18, Andrew Cooper wrote: + +if ( ptr[0] == regs->rip && ptr[1] == regs->cs ) +{ +asm ( "wrssq %[fix],

Re: [PATCH v2 10/14] x86/extable: Adjust extable handling to be shadow stack compatible

2020-06-02 Thread Jan Beulich
On 29.05.2020 21:43, Andrew Cooper wrote: > On 28/05/2020 17:15, Jan Beulich wrote: >> On 27.05.2020 21:18, Andrew Cooper wrote: >>> @@ -763,6 +775,56 @@ static void do_reserved_trap(struct cpu_user_regs >>> *regs) >>>trapnr, vec_name(trapnr), regs->error_code); >>> } >>> >>> +stati

Re: [PATCH v2 10/14] x86/extable: Adjust extable handling to be shadow stack compatible

2020-05-29 Thread Andrew Cooper
On 29/05/2020 20:43, Andrew Cooper wrote: > On 28/05/2020 17:15, Jan Beulich wrote: >> On 27.05.2020 21:18, Andrew Cooper wrote: >>> + >>> +if ( ptr[0] == regs->rip && ptr[1] == regs->cs ) >>> +{ >>> +asm ( "wrssq %[fix], %[stk]" >>> + : [stk] "=m" (*ptr

Re: [PATCH v2 10/14] x86/extable: Adjust extable handling to be shadow stack compatible

2020-05-29 Thread Andrew Cooper
On 28/05/2020 17:15, Jan Beulich wrote: > On 27.05.2020 21:18, Andrew Cooper wrote: >> @@ -400,6 +400,18 @@ unsigned long get_stack_trace_bottom(unsigned long sp) >> } >> } >> >> +static unsigned long get_shstk_bottom(unsigned long sp) >> +{ >> +switch ( get_stack_page(sp) ) >> +{ >

Re: [PATCH v2 10/14] x86/extable: Adjust extable handling to be shadow stack compatible

2020-05-28 Thread Jan Beulich
On 27.05.2020 21:18, Andrew Cooper wrote: > @@ -400,6 +400,18 @@ unsigned long get_stack_trace_bottom(unsigned long sp) > } > } > > +static unsigned long get_shstk_bottom(unsigned long sp) > +{ > +switch ( get_stack_page(sp) ) > +{ > +#ifdef CONFIG_XEN_SHSTK > +case 0: return R

[PATCH v2 10/14] x86/extable: Adjust extable handling to be shadow stack compatible

2020-05-27 Thread Andrew Cooper
When adjusting an IRET frame to recover from a fault, and equivalent adjustment needs making in the shadow IRET frame. The adjustment in exception_with_ints_disabled() could in principle be an alternative block rather than an ifdef, as the only two current users of _PRE_EXTABLE() are IRET-to-guest