Skip to content

Commit 0fe1ebf

Browse files
oleg-nesterovkees
authored andcommitted
seccomp/mips: change syscall_trace_enter() to use secure_computing()
arch/mips/Kconfig selects HAVE_ARCH_SECCOMP_FILTER so syscall_trace_enter() can just use __secure_computing(NULL) and rely on populate_seccomp_data(sd) and "sd == NULL" checks in __secure_computing(sd) paths. With the change above syscall_trace_enter() can just use secure_computing() and avoid #ifdef + test_thread_flag(TIF_SECCOMP). CONFIG_GENERIC_ENTRY is not defined, so test_syscall_work(SECCOMP) will check TIF_SECCOMP. Signed-off-by: Oleg Nesterov <[email protected]> Acked-by: Thomas Bogendoerfer <[email protected]> Reviewed-by: Kees Cook <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Kees Cook <[email protected]>
1 parent 18f7686 commit 0fe1ebf

File tree

1 file changed

+2
-18
lines changed

1 file changed

+2
-18
lines changed

arch/mips/kernel/ptrace.c

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1326,24 +1326,8 @@ asmlinkage long syscall_trace_enter(struct pt_regs *regs)
13261326
return -1;
13271327
}
13281328

1329-
#ifdef CONFIG_SECCOMP
1330-
if (unlikely(test_thread_flag(TIF_SECCOMP))) {
1331-
int ret, i;
1332-
struct seccomp_data sd;
1333-
unsigned long args[6];
1334-
1335-
sd.nr = current_thread_info()->syscall;
1336-
sd.arch = syscall_get_arch(current);
1337-
syscall_get_arguments(current, regs, args);
1338-
for (i = 0; i < 6; i++)
1339-
sd.args[i] = args[i];
1340-
sd.instruction_pointer = KSTK_EIP(current);
1341-
1342-
ret = __secure_computing(&sd);
1343-
if (ret == -1)
1344-
return ret;
1345-
}
1346-
#endif
1329+
if (secure_computing())
1330+
return -1;
13471331

13481332
if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT)))
13491333
trace_sys_enter(regs, regs->regs[2]);

0 commit comments

Comments
 (0)