linux-audit.redhat.com archive mirror
 help / color / mirror / Atom feed
From: "Dmitry V. Levin" <ldv@altlinux.org>
To: Max Filippov <jcmvbkbc@gmail.com>
Cc: oleg@redhat.com, Andrew Lutomirski <luto@kernel.org>,
	lineprinter@altlinux.org, esyr@redhat.com,
	Chris Zankel <chris@zankel.net>, Paul Moore <paul@paul-moore.com>,
	eparis@redhat.com, linux-xtensa@linux-xtensa.org,
	linux-audit@redhat.com, LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v5 19/25] xtensa: define syscall_get_* functions
Date: Mon, 10 Dec 2018 15:53:15 +0300	[thread overview]
Message-ID: <20181210125315.GB11942@altlinux.org> (raw)
In-Reply-To: <CAMo8Bf+s6xObgYoOOR0NTQZR-ReBbXmNv_5Jf=jX7J+bnDsTYQ@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2908 bytes --]

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@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 #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

  reply	other threads:[~2018-12-10 12:53 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-10  4:23 [PATCH v5 00/25] ptrace: add PTRACE_GET_SYSCALL_INFO request Dmitry V. Levin
2018-12-10  4:29 ` [PATCH v5 03/25] arc: define syscall_get_arch() Dmitry V. Levin
2018-12-10  4:29 ` [PATCH v5 04/25] c6x: " Dmitry V. Levin
2018-12-11 22:40   ` Mark Salter
2018-12-10  4:29 ` [PATCH v5 06/25] csky: " Dmitry V. Levin
2018-12-10  4:29 ` [PATCH v5 07/25] h8300: define remaining syscall_get_* functions Dmitry V. Levin
2018-12-10  4:29 ` [PATCH v5 09/25] hexagon: " Dmitry V. Levin
2018-12-10  4:29 ` [PATCH v5 11/25] nds32: define syscall_get_arch() Dmitry V. Levin
2018-12-10  4:30 ` [PATCH v5 12/25] nios2: " Dmitry V. Levin
2018-12-10  4:30 ` [PATCH v5 17/25] riscv: " Dmitry V. Levin
2018-12-10  4:30 ` [PATCH v5 19/25] xtensa: define syscall_get_* functions Dmitry V. Levin
2018-12-10  5:02   ` Max Filippov
2018-12-10 12:53     ` Dmitry V. Levin [this message]
2018-12-10 20:14       ` Max Filippov
2018-12-10 20:24         ` Dmitry V. Levin
2018-12-10 20:30           ` Dmitry V. Levin
2018-12-10 21:29             ` Max Filippov
2018-12-12 10:45   ` kbuild test robot
2018-12-19  5:58   ` kbuild test robot
2018-12-10  4:30 ` [PATCH v5 21/25] unicore32: add asm/syscall.h Dmitry V. Levin
2018-12-10  4:31 ` [PATCH v5 22/25] syscall_get_arch: add "struct task_struct *" argument Dmitry V. Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181210125315.GB11942@altlinux.org \
    --to=ldv@altlinux.org \
    --cc=chris@zankel.net \
    --cc=eparis@redhat.com \
    --cc=esyr@redhat.com \
    --cc=jcmvbkbc@gmail.com \
    --cc=lineprinter@altlinux.org \
    --cc=linux-audit@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-xtensa@linux-xtensa.org \
    --cc=luto@kernel.org \
    --cc=oleg@redhat.com \
    --cc=paul@paul-moore.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).