On Thu, Sep 19, 2019 at 05:03:18PM +0200, Thomas Gleixner wrote:
>  #ifdef CONFIG_ARM64_ERRATUM_1463225
> @@ -97,19 +97,16 @@ static void el0_svc_common(struct pt_reg
>  
>       regs->orig_x0 = regs->regs[0];
>       regs->syscallno = scno;
> +     /* Set default error number */
> +     regs->regs[0] = -ENOSYS;

I think this corrupts the first argument of all valid syscalls.
SC_ARM64_REGS_TO_ARGS uses regs[0] instead of orig_x0. ptrace should be
fine since it calls syscall_get_arguments() which uses orig_x0.

We could change the SC_ARM64_REGS_TO_ARGS macro though (in theory there
shouldn't be any performance hit as it's already cached).

>  
>       cortex_a76_erratum_1463225_svc_handler();
>       local_daif_restore(DAIF_PROCCTX);
>       user_exit();
>  
> -     if (has_syscall_work(flags)) {
> -             /* set default errno for user-issued syscall(-1) */
> -             if (scno == NO_SYSCALL)
> -                     regs->regs[0] = -ENOSYS;
> -             scno = syscall_trace_enter(regs);
> -             if (scno == NO_SYSCALL)
> -                     goto trace_exit;
> -     }
> +     scno = syscall_enter_from_usermode(regs, scno);
> +     if (scno == NO_SYSCALL)
> +             goto trace_exit;
>  
>       invoke_syscall(regs, scno, sc_nr, syscall_table);

-- 
Catalin

Reply via email to