diff options
author | Guo Ren <guoren@linux.alibaba.com> | 2020-05-26 08:11:52 +0000 |
---|---|---|
committer | Guo Ren <guoren@linux.alibaba.com> | 2020-07-31 01:51:05 +0000 |
commit | e95a4f8cb985e759648b32ed0b721a472deb86a5 (patch) | |
tree | 9768d128f9b8c74d12bd1b3a5ab64420de1ca72a /arch/csky/kernel/ptrace.c | |
parent | c23dd2405fc2054345be33f8bb1d04b3b805202d (diff) | |
download | linux-e95a4f8cb985e759648b32ed0b721a472deb86a5.tar.bz2 |
csky: Add SECCOMP_FILTER supported
secure_computing() is called first in syscall_trace_enter() so that
a system call will be aborted quickly without doing succeeding syscall
tracing if seccomp rules want to deny that system call.
TODO:
- Update https://github.com/seccomp/libseccomp csky support
Signed-off-by: Guo Ren <guoren@linux.alibaba.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Diffstat (limited to 'arch/csky/kernel/ptrace.c')
-rw-r--r-- | arch/csky/kernel/ptrace.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/arch/csky/kernel/ptrace.c b/arch/csky/kernel/ptrace.c index 944ca2fdcdd9..0de10f7beae6 100644 --- a/arch/csky/kernel/ptrace.c +++ b/arch/csky/kernel/ptrace.c @@ -320,16 +320,20 @@ long arch_ptrace(struct task_struct *child, long request, return ret; } -asmlinkage void syscall_trace_enter(struct pt_regs *regs) +asmlinkage int syscall_trace_enter(struct pt_regs *regs) { if (test_thread_flag(TIF_SYSCALL_TRACE)) if (tracehook_report_syscall_entry(regs)) - syscall_set_nr(current, regs, -1); + return -1; + + if (secure_computing() == -1) + return -1; if (test_thread_flag(TIF_SYSCALL_TRACEPOINT)) trace_sys_enter(regs, syscall_get_nr(current, regs)); audit_syscall_entry(regs_syscallid(regs), regs->a0, regs->a1, regs->a2, regs->a3); + return 0; } asmlinkage void syscall_trace_exit(struct pt_regs *regs) |