Hi,

On Sun, Dec 09, 2018 at 09:02:50PM -0800, Max Filippov wrote:
> Hello,
> 
> On Sun, Dec 9, 2018 at 8:30 PM Dmitry V. Levin <l...@altlinux.org> wrote:
> > syscall_get_* functions are required to be implemented on all
> > architectures in order to extend the generic ptrace API with
> > PTRACE_GET_SYSCALL_INFO request.
> >
> > This adds all 5 syscall_get_* functions on xtensa as documented
> > in asm-generic/syscall.h: syscall_get_nr, syscall_get_arguments,
> > syscall_get_error, syscall_get_return_value, and syscall_get_arch.
> 
> I have this set of functions plus syscall_set_arguments implemented
> for syscall tracing here:
>   
> https://github.com/jcmvbkbc/linux-xtensa/commit/0023f56298cc92ce47e61b1b5dd1038f7be4f826

Good, but we also need syscall_get_arch for PTRACE_GET_SYSCALL_INFO.

> How should we synchronize our changes?

No problem, I can revert to the previous edition of this patch
that just adds syscall_get_arch.
Alternatively, you can just take that couple of patches (v5 18/25
and v2 15/15) into your tree.

> > diff --git a/arch/xtensa/include/asm/syscall.h 
> > b/arch/xtensa/include/asm/syscall.h
> > index 3673ff1f1bc5..d529c855a144 100644
> > --- a/arch/xtensa/include/asm/syscall.h
> > +++ b/arch/xtensa/include/asm/syscall.h
> 
> [...]
> 
> > +static inline void
> > +syscall_get_arguments(struct task_struct *task, struct pt_regs *regs,
> > +                     unsigned int i, unsigned int n, unsigned long *args)
> > +{
> > +       switch (i) {
> > +       case 0:
> > +               if (!n--)
> > +                       break;
> > +               *args++ = regs->areg[6];
> > +               /* fall through */
> > +       case 1:
> > +               if (!n--)
> > +                       break;
> > +               *args++ = regs->areg[3];
> > +               /* fall through */
> > +       case 2:
> > +               if (!n--)
> > +                       break;
> > +               *args++ = regs->areg[4];
> > +               /* fall through */
> > +       case 3:
> > +               if (!n--)
> > +                       break;
> > +               *args++ = regs->areg[5];
> > +               /* fall through */
> > +       case 4:
> > +               if (!n--)
> > +                       break;
> > +               *args++ = regs->areg[8];
> > +               /* fall through */
> > +       case 5:
> > +               if (!n--)
> > +                       break;
> > +               *args++ = regs->areg[9];
> > +               /* fall through */
> > +       case 6:
> > +               if (!n--)
> > +                       break;
> > +               /* fall through */
> > +       default:
> > +               BUG();
> 
> A WARN should be enough.

This is what most of other architectures do in syscall_get_arguments,
but I agree that a WARN_ON_ONCE should be enough.


-- 
ldv

Attachment: signature.asc
Description: PGP signature

Reply via email to