do_exit() calls prace_stop() which may require access to all saved registers. We only save those registers not preserved by C code currently. Provide a special syscall entry for exit and exit_group syscalls similar to that used by clone and clone3, which have the same requirements. No fix to io_uring appears to be needed, because m68k copy_thread treats kernel threads the same as e.g. alpha does, and copies only a subset of registers in that case. CC: Eric W. Biederman <ebiederm@xxxxxxxxxxxx> CC: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> CC: Andreas Schwab <schwab@xxxxxxxxxxxxxx> Signed-off-by: Michael Schmitz <schmitzmic@xxxxxxxxx> --- arch/m68k/kernel/entry.S | 14 ++++++++++++++ arch/m68k/kernel/process.c | 16 ++++++++++++++++ arch/m68k/kernel/syscalls/syscall.tbl | 4 ++-- 3 files changed, 32 insertions(+), 2 deletions(-) diff --git a/arch/m68k/kernel/entry.S b/arch/m68k/kernel/entry.S index 9dd76fb..1e067e6 100644 --- a/arch/m68k/kernel/entry.S +++ b/arch/m68k/kernel/entry.S @@ -76,6 +76,20 @@ ENTRY(__sys_clone3) lea %sp@(28),%sp rts +ENTRY(__sys_exit) + SAVE_SWITCH_STACK + pea %sp@(SWITCH_STACK_SIZE) + jbsr m68k_exit + lea %sp@(28),%sp + rts + +ENTRY(__sys_exit_group) + SAVE_SWITCH_STACK + pea %sp@(SWITCH_STACK_SIZE) + jbsr m68k_exit_group + lea %sp@(28),%sp + rts + ENTRY(sys_sigreturn) SAVE_SWITCH_STACK movel %sp,%sp@- | switch_stack pointer diff --git a/arch/m68k/kernel/process.c b/arch/m68k/kernel/process.c index da83cc8..df4e5f1 100644 --- a/arch/m68k/kernel/process.c +++ b/arch/m68k/kernel/process.c @@ -138,6 +138,22 @@ asmlinkage int m68k_clone3(struct pt_regs *regs) return sys_clone3((struct clone_args __user *)regs->d1, regs->d2); } +/* + * Because extra registers are saved on the stack after the sys_exit() + * arguments, this C wrapper extracts them from pt_regs * and then calls the + * generic sys_exit() implementation. + */ +asmlinkage int m68k_exit(struct pt_regs *regs) +{ + return sys_exit(regs->d1); +} + +/* Same for sys_exit_group ... */ +asmlinkage int m68k_exit_group(struct pt_regs *regs) +{ + return sys_exit_group(regs->d1); +} + int copy_thread(unsigned long clone_flags, unsigned long usp, unsigned long arg, struct task_struct *p, unsigned long tls) { diff --git a/arch/m68k/kernel/syscalls/syscall.tbl b/arch/m68k/kernel/syscalls/syscall.tbl index 0dd019d..3d5b6fbc 100644 --- a/arch/m68k/kernel/syscalls/syscall.tbl +++ b/arch/m68k/kernel/syscalls/syscall.tbl @@ -8,7 +8,7 @@ # The <abi> is always "common" for this file # 0 common restart_syscall sys_restart_syscall -1 common exit sys_exit +1 common exit __sys_exit 2 common fork __sys_fork 3 common read sys_read 4 common write sys_write @@ -254,7 +254,7 @@ 244 common io_submit sys_io_submit 245 common io_cancel sys_io_cancel 246 common fadvise64 sys_fadvise64 -247 common exit_group sys_exit_group +247 common exit_group __sys_exit_group 248 common lookup_dcookie sys_lookup_dcookie 249 common epoll_create sys_epoll_create 250 common epoll_ctl sys_epoll_ctl -- 2.7.4