Messages in this thread | | | Date | Mon, 10 Dec 2018 15:40:59 +0300 | From | "Dmitry V. Levin" <> | Subject | Re: [PATCH v5 13/25] m68k: add asm/syscall.h |
| |
Hi Geert,
On Mon, Dec 10, 2018 at 09:45:42AM +0100, Geert Uytterhoeven wrote: > Hi Dmitry, > > On Mon, Dec 10, 2018 at 5:30 AM 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 introduces asm/syscall.h on m68k implementing all 5 syscall_get_* > > functions as documented in asm-generic/syscall.h: syscall_get_nr, > > syscall_get_arguments, syscall_get_error, syscall_get_return_value, > > and syscall_get_arch. > > > > Cc: Geert Uytterhoeven <geert@linux-m68k.org> > > Cc: Oleg Nesterov <oleg@redhat.com> > > Cc: Andy Lutomirski <luto@kernel.org> > > Cc: Elvira Khabirova <lineprinter@altlinux.org> > > Cc: Eugene Syromyatnikov <esyr@redhat.com> > > Cc: linux-m68k@lists.linux-m68k.org > > Signed-off-by: Dmitry V. Levin <ldv@altlinux.org> > > --- > > > > Notes: > > v5: added syscall_get_nr, syscall_get_arguments, syscall_get_error, > > and syscall_get_return_value > > v1: added syscall_get_arch > > > --- /dev/null > > +++ b/arch/m68k/include/asm/syscall.h > > @@ -0,0 +1,39 @@ > > > +static inline void > > +syscall_get_arguments(struct task_struct *task, struct pt_regs *regs, > > + unsigned int i, unsigned int n, unsigned long *args) > > +{ > > + BUG_ON(i + n > 6); > > Does this have to crash the kernel?
This is what most of other architectures do, but we could choose a softer approach, e.g. use WARN_ON_ONCE instead.
> Perhaps you can return an error code instead?
That would be problematic given the signature of this function and the nature of the potential bug which would most likely be a usage error.
-- ldv [unhandled content-type:application/pgp-signature] | |