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 | |
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')
-rw-r--r-- | arch/csky/kernel/entry.S | 3 | ||||
-rw-r--r-- | arch/csky/kernel/ptrace.c | 8 |
2 files changed, 9 insertions, 2 deletions
diff --git a/arch/csky/kernel/entry.S b/arch/csky/kernel/entry.S index f13800383a19..efd2e696e3cd 100644 --- a/arch/csky/kernel/entry.S +++ b/arch/csky/kernel/entry.S @@ -168,6 +168,8 @@ ENTRY(csky_systemcall) csky_syscall_trace: mov a0, sp /* sp = pt_regs pointer */ jbsr syscall_trace_enter + cmpnei a0, 0 + bt 1f /* Prepare args before do system call */ ldw a0, (sp, LSAVE_A0) ldw a1, (sp, LSAVE_A1) @@ -188,6 +190,7 @@ csky_syscall_trace: #endif stw a0, (sp, LSAVE_A0) /* Save return value */ +1: #ifdef CONFIG_DEBUG_RSEQ mov a0, sp jbsr rseq_syscall 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) |