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>
This commit is contained in:
Guo Ren
2020-05-26 08:11:52 +00:00
parent c23dd2405f
commit e95a4f8cb9
6 changed files with 37 additions and 4 deletions

View File

@@ -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)