On Wed, Mar 17 2021 at 11:12, Andy Lutomirski wrote:
> The new common syscall API had a large and confusing API surface.  Simplify
> it.  Now there is exactly one way to use it.  It's a bit more verbose than
> the old way for the simple x86_64 native case, but it's much easier to use
> right,

and therefore much easier to get wrong...

>  __visible noinstr void do_syscall_64(unsigned long nr, struct pt_regs *regs)
>  {
> -     nr = syscall_enter_from_user_mode(regs, nr);
> -
> +     kentry_enter_from_user_mode(regs);
> +     local_irq_enable();

... That needs to be _after_ instrumentation_begin(). If you fiddle
with this then please make sure that objtool validates noinstr...

> +     kentry_enter_from_user_mode(regs);
> +     local_irq_enable();

Ditto

> +     instrumentation_begin();
>  static noinstr bool __do_fast_syscall_32(struct pt_regs *regs)
>  {
>       unsigned int nr = syscall_32_enter(regs);
> +     bool ret;
>       int res;
>  
> -     /*
> -      * This cannot use syscall_enter_from_user_mode() as it has to
> -      * fetch EBP before invoking any of the syscall entry work
> -      * functions.
> -      */
> -     syscall_enter_from_user_mode_prepare(regs);
> -
> +     kentry_enter_from_user_mode(regs);
> +     local_irq_enable();

...

>       instrumentation_begin();

Thanks,

        tglx

Reply via email to