Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9d37c405 authored by Markos Chandras's avatar Markos Chandras Committed by Ralf Baechle
Browse files

MIPS: kernel: scalls: Skip the syscall if denied by the seccomp filter

parent 1225eb82
Loading
Loading
Loading
Loading
+3 −1
Original line number Original line Diff line number Diff line
@@ -120,6 +120,8 @@ syscall_trace_entry:
	move	a0, sp
	move	a0, sp
	jal	syscall_trace_enter
	jal	syscall_trace_enter


	bltz	v0, 2f			# seccomp failed? Skip syscall

	move	t0, s0
	move	t0, s0
	RESTORE_STATIC
	RESTORE_STATIC
	lw	a0, PT_R4(sp)		# Restore argument registers
	lw	a0, PT_R4(sp)		# Restore argument registers
@@ -138,7 +140,7 @@ syscall_trace_entry:
	sw	t1, PT_R0(sp)		# save it for syscall restarting
	sw	t1, PT_R0(sp)		# save it for syscall restarting
1:	sw	v0, PT_R2(sp)		# result
1:	sw	v0, PT_R2(sp)		# result


	j	syscall_exit
2:	j	syscall_exit


/* ------------------------------------------------------------------------ */
/* ------------------------------------------------------------------------ */


+3 −1
Original line number Original line Diff line number Diff line
@@ -82,6 +82,8 @@ syscall_trace_entry:
	move	a0, sp
	move	a0, sp
	jal	syscall_trace_enter
	jal	syscall_trace_enter


	bltz	v0, 2f			# seccomp failed? Skip syscall

	move	t0, s0
	move	t0, s0
	RESTORE_STATIC
	RESTORE_STATIC
	ld	a0, PT_R4(sp)		# Restore argument registers
	ld	a0, PT_R4(sp)		# Restore argument registers
@@ -102,7 +104,7 @@ syscall_trace_entry:
	sd	t1, PT_R0(sp)		# save it for syscall restarting
	sd	t1, PT_R0(sp)		# save it for syscall restarting
1:	sd	v0, PT_R2(sp)		# result
1:	sd	v0, PT_R2(sp)		# result


	j	syscall_exit
2:	j	syscall_exit


illegal_syscall:
illegal_syscall:
	/* This also isn't a 64-bit syscall, throw an error.  */
	/* This also isn't a 64-bit syscall, throw an error.  */
+3 −1
Original line number Original line Diff line number Diff line
@@ -74,6 +74,8 @@ n32_syscall_trace_entry:
	move	a0, sp
	move	a0, sp
	jal	syscall_trace_enter
	jal	syscall_trace_enter


	bltz	v0, 2f			# seccomp failed? Skip syscall

	move	t0, s0
	move	t0, s0
	RESTORE_STATIC
	RESTORE_STATIC
	ld	a0, PT_R4(sp)		# Restore argument registers
	ld	a0, PT_R4(sp)		# Restore argument registers
@@ -94,7 +96,7 @@ n32_syscall_trace_entry:
	sd	t1, PT_R0(sp)		# save it for syscall restarting
	sd	t1, PT_R0(sp)		# save it for syscall restarting
1:	sd	v0, PT_R2(sp)		# result
1:	sd	v0, PT_R2(sp)		# result


	j	syscall_exit
2:	j	syscall_exit


not_n32_scall:
not_n32_scall:
	/* This is not an n32 compatibility syscall, pass it on to
	/* This is not an n32 compatibility syscall, pass it on to
+3 −1
Original line number Original line Diff line number Diff line
@@ -114,6 +114,8 @@ trace_a_syscall:
	move	a0, sp
	move	a0, sp
	jal	syscall_trace_enter
	jal	syscall_trace_enter


	bltz	v0, 2f			# seccomp failed? Skip syscall

	move	t0, s0
	move	t0, s0
	RESTORE_STATIC
	RESTORE_STATIC
	ld	a0, PT_R4(sp)		# Restore argument registers
	ld	a0, PT_R4(sp)		# Restore argument registers
@@ -136,7 +138,7 @@ trace_a_syscall:
	sd	t1, PT_R0(sp)		# save it for syscall restarting
	sd	t1, PT_R0(sp)		# save it for syscall restarting
1:	sd	v0, PT_R2(sp)		# result
1:	sd	v0, PT_R2(sp)		# result


	j	syscall_exit
2:	j	syscall_exit


/* ------------------------------------------------------------------------ */
/* ------------------------------------------------------------------------ */