aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/seccomp
diff options
context:
space:
mode:
authorGuo Ren <guoren@linux.alibaba.com>2020-05-26 08:11:52 +0000
committerGuo Ren <guoren@linux.alibaba.com>2020-07-31 01:51:05 +0000
commite95a4f8cb985e759648b32ed0b721a472deb86a5 (patch)
tree9768d128f9b8c74d12bd1b3a5ab64420de1ca72a /tools/testing/selftests/seccomp
parentcsky: remove unusued thread_saved_pc and *_segments functions/macros (diff)
downloadlinux-dev-e95a4f8cb985e759648b32ed0b721a472deb86a5.tar.xz
linux-dev-e95a4f8cb985e759648b32ed0b721a472deb86a5.zip
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 'tools/testing/selftests/seccomp')
-rw-r--r--tools/testing/selftests/seccomp/seccomp_bpf.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/tools/testing/selftests/seccomp/seccomp_bpf.c b/tools/testing/selftests/seccomp/seccomp_bpf.c
index 252140a52553..8d18a0ddafdd 100644
--- a/tools/testing/selftests/seccomp/seccomp_bpf.c
+++ b/tools/testing/selftests/seccomp/seccomp_bpf.c
@@ -116,6 +116,8 @@ struct seccomp_data {
# define __NR_seccomp 277
# elif defined(__riscv)
# define __NR_seccomp 277
+# elif defined(__csky__)
+# define __NR_seccomp 277
# elif defined(__hppa__)
# define __NR_seccomp 338
# elif defined(__powerpc__)
@@ -1603,6 +1605,14 @@ TEST_F(TRACE_poke, getpid_runs_normally)
# define ARCH_REGS struct user_regs_struct
# define SYSCALL_NUM a7
# define SYSCALL_RET a0
+#elif defined(__csky__)
+# define ARCH_REGS struct pt_regs
+#if defined(__CSKYABIV2__)
+# define SYSCALL_NUM regs[3]
+#else
+# define SYSCALL_NUM regs[9]
+#endif
+# define SYSCALL_RET a0
#elif defined(__hppa__)
# define ARCH_REGS struct user_regs_struct
# define SYSCALL_NUM gr[20]
@@ -1693,7 +1703,8 @@ void change_syscall(struct __test_metadata *_metadata,
EXPECT_EQ(0, ret) {}
#if defined(__x86_64__) || defined(__i386__) || defined(__powerpc__) || \
- defined(__s390__) || defined(__hppa__) || defined(__riscv)
+ defined(__s390__) || defined(__hppa__) || defined(__riscv) || \
+ defined(__csky__)
{
regs.SYSCALL_NUM = syscall;
}