Re: [PATCH v6 2/2] m68k: add kernel seccomp support

Michael Schmitz
2021-06-28T20:17:29Z

Hi Geert,

On 28/06/21 7:23 pm, Geert Uytterhoeven wrote:
>
>> --- a/arch/m68k/include/asm/syscall.h
>> +++ b/arch/m68k/include/asm/syscall.h
>> @@ -4,6 +4,39 @@
>>
>> #include <uapi/linux/audit.h>
>>
>> +#include <asm/unistd.h>
>> +
>> +extern const unsigned long sys_call_table[];
>> +
>> +static inline int syscall_get_nr(struct task_struct *task,
>> + struct pt_regs *regs)
>> +{
>> + return regs->orig_d0;
>> +}
>> +
>> +static inline void syscall_rollback(struct task_struct *task,
>> + struct pt_regs *regs)
>> +{
>> + regs->d0 = regs->orig_d0;
>> +}
>> +
>> +static inline void syscall_set_return_value(struct task_struct *task,
>> + struct pt_regs *regs,
>> + int error, long val)
>> +{
>> + regs->d0 = (long) error ? error : val;
>> +}
>> +
>> +static inline void syscall_get_arguments(struct task_struct *task,
>> + struct pt_regs *regs,
>> + unsigned long *args)
>> +{
>> + args[0] = regs->orig_d0;
>> + args++;
>> +
>> + memcpy(args, &regs->d1, 5 * sizeof(args[0]));
>> +}
>> +
>> static inline int syscall_get_arch(struct task_struct *task)
>> {
>> return AUDIT_ARCH_M68K;
> Comparing this to what I had before, I noticed syscall_get_return_value()
> is missing.
Yes - I only added the bare minimum I needed to compile.
> Upon closer look, we don't need it (yet), as we don't select any
> of GENERIC_ENTRY, HAVE_ARCH_TRACEHOOK, or HAVE_SYSCALL_TRACEPOINTS,
> but why not add it while we're at it?

I can do that - the trouble with this entire series is that I can't
meaningfully test anything. But syscall_get_return_value() isn't that
difficult.

Cheers,

Michael

>
> Gr{oetje,eeting}s,
>
> Geert
>