riscv: Enable seccomp architecture tracking
authorYiFei Zhu <yifeifz2@illinois.edu>
Wed, 11 Nov 2020 13:33:50 +0000 (07:33 -0600)
committerKees Cook <keescook@chromium.org>
Fri, 20 Nov 2020 19:16:35 +0000 (11:16 -0800)
To enable seccomp constant action bitmaps, we need to have a static
mapping to the audit architecture and system call table size. Add these
for riscv.

Signed-off-by: YiFei Zhu <yifeifz2@illinois.edu>
Signed-off-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/58ef925d00505cbb77478fa6bd2b48ab2d902460.1605101222.git.yifeifz2@illinois.edu
arch/riscv/include/asm/seccomp.h

index bf7744e..c7ee6a3 100644 (file)
@@ -7,4 +7,14 @@
 
 #include <asm-generic/seccomp.h>
 
+#ifdef CONFIG_64BIT
+# define SECCOMP_ARCH_NATIVE           AUDIT_ARCH_RISCV64
+# define SECCOMP_ARCH_NATIVE_NR                NR_syscalls
+# define SECCOMP_ARCH_NATIVE_NAME      "riscv64"
+#else /* !CONFIG_64BIT */
+# define SECCOMP_ARCH_NATIVE           AUDIT_ARCH_RISCV32
+# define SECCOMP_ARCH_NATIVE_NR                NR_syscalls
+# define SECCOMP_ARCH_NATIVE_NAME      "riscv32"
+#endif
+
 #endif /* _ASM_SECCOMP_H */