lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20181210125315.GB11942@altlinux.org>
Date:   Mon, 10 Dec 2018 15:53:15 +0300
From:   "Dmitry V. Levin" <ldv@...linux.org>
To:     Max Filippov <jcmvbkbc@...il.com>
Cc:     oleg@...hat.com, Andrew Lutomirski <luto@...nel.org>,
        lineprinter@...linux.org, esyr@...hat.com,
        Chris Zankel <chris@...kel.net>,
        Paul Moore <paul@...l-moore.com>, eparis@...hat.com,
        linux-xtensa@...ux-xtensa.org, linux-audit@...hat.com,
        LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v5 19/25] xtensa: define syscall_get_* functions

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 <ldv@...linux.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

Download attachment "signature.asc" of type "application/pgp-signature" (802 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ