Commit 2ca8a1de authored by Michael Schmitz's avatar Michael Schmitz Committed by Geert Uytterhoeven
Browse files

m68k: Check syscall_trace_enter() return code



Check return code of syscall_trace_enter(), and skip syscall
if -1. Return code will be left at what had been set by
ptrace or seccomp (in regs->d0).

No regression seen in testing with strace on ARAnyM.

Signed-off-by: default avatarMichael Schmitz <schmitzmic@gmail.com>
Reviewed-by: default avatarGeert Uytterhoeven <geert@linux-m68k.org>
Link: https://lore.kernel.org/r/20230112035529.13521-2-schmitzmic@gmail.com


Signed-off-by: default avatarGeert Uytterhoeven <geert@linux-m68k.org>
parent 65a16016
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -45,6 +45,8 @@ do_trace:
	jbsr	syscall_trace_enter
	RESTORE_SWITCH_STACK
	addql	#4,%sp
	addql	#1,%d0
	jeq	ret_from_exception
	movel	%sp@(PT_OFF_ORIG_D0),%d1
	movel	#-ENOSYS,%d0
	cmpl	#NR_syscalls,%d1
+2 −0
Original line number Diff line number Diff line
@@ -90,6 +90,8 @@ ENTRY(system_call)
	jbsr	syscall_trace_enter
	RESTORE_SWITCH_STACK
	addql	#4,%sp
	addql	#1,%d0
	jeq	ret_from_exception
	movel	%d3,%a0
	jbsr	%a0@
	movel	%d0,%sp@(PT_OFF_D0)		/* save the return value */
+3 −0
Original line number Diff line number Diff line
@@ -184,9 +184,12 @@ do_trace_entry:
	jbsr	syscall_trace_enter
	RESTORE_SWITCH_STACK
	addql	#4,%sp
	addql	#1,%d0			| optimization for cmpil #-1,%d0
	jeq	ret_from_syscall
	movel	%sp@(PT_OFF_ORIG_D0),%d0
	cmpl	#NR_syscalls,%d0
	jcs	syscall
	jra	ret_from_syscall
badsys:
	movel	#-ENOSYS,%sp@(PT_OFF_D0)
	jra	ret_from_syscall