Update RISC-V patch
Signed-off-by: David Abdurachmanov <david.abdurachmanov@sifive.com>
This commit is contained in:
parent
6b3bdae024
commit
f5fa1662ca
@ -1,3 +1,92 @@
|
||||
diff --git a/src/basic/missing_syscall.h b/src/basic/missing_syscall.h
|
||||
index 6d9b125..6586d58 100644
|
||||
--- a/src/basic/missing_syscall.h
|
||||
+++ b/src/basic/missing_syscall.h
|
||||
@@ -59,6 +59,8 @@ static inline int missing_pivot_root(const char *new_root, const char *put_old)
|
||||
# define __NR_memfd_create 356
|
||||
# elif defined __arc__
|
||||
# define __NR_memfd_create 279
|
||||
+# elif defined __riscv
|
||||
+# define __NR_memfd_create 279
|
||||
# else
|
||||
# warning "__NR_memfd_create unknown for your architecture"
|
||||
# endif
|
||||
@@ -112,6 +114,8 @@ static inline int missing_memfd_create(const char *name, unsigned int flags) {
|
||||
# endif
|
||||
# elif defined(__arc__)
|
||||
# define __NR_getrandom 278
|
||||
+# elif defined(__riscv)
|
||||
+# define __NR_getrandom 278
|
||||
# else
|
||||
# warning "__NR_getrandom unknown for your architecture"
|
||||
# endif
|
||||
@@ -253,6 +257,8 @@ static inline pid_t raw_getpid(void) {
|
||||
# define __NR_renameat2 347
|
||||
# elif defined __arc__
|
||||
# define __NR_renameat2 276
|
||||
+# elif defined __riscv
|
||||
+# define __NR_renameat2 276
|
||||
# else
|
||||
# warning "__NR_renameat2 unknown for your architecture"
|
||||
# endif
|
||||
@@ -344,6 +350,8 @@ static inline key_serial_t missing_request_key(const char *type, const char *des
|
||||
# define __NR_copy_file_range 379
|
||||
# elif defined __arc__
|
||||
# define __NR_copy_file_range 285
|
||||
+# elif defined __riscv
|
||||
+# define __NR_copy_file_range 285
|
||||
# else
|
||||
# warning "__NR_copy_file_range not defined for your architecture"
|
||||
# endif
|
||||
@@ -386,6 +394,8 @@ static inline ssize_t missing_copy_file_range(int fd_in, loff_t *off_in,
|
||||
# define __NR_bpf 351
|
||||
# elif defined __tilegx__
|
||||
# define __NR_bpf 280
|
||||
+# elif defined __riscv
|
||||
+# define __NR_bpf 280
|
||||
# else
|
||||
# warning "__NR_bpf not defined for your architecture"
|
||||
# endif
|
||||
@@ -435,6 +445,8 @@ static inline int missing_bpf(int cmd, union bpf_attr *attr, size_t size) {
|
||||
# if _MIPS_SIM == _MIPS_SIM_ABI64
|
||||
# define __NR_pkey_mprotect 5323
|
||||
# endif
|
||||
+# elif defined __riscv
|
||||
+# define __NR_pkey_mprotect 288
|
||||
# else
|
||||
# warning "__NR_pkey_mprotect not defined for your architecture"
|
||||
# endif
|
||||
@@ -459,6 +471,8 @@ static inline int missing_bpf(int cmd, union bpf_attr *attr, size_t size) {
|
||||
# define __NR_statx 360
|
||||
# elif defined __x86_64__
|
||||
# define __NR_statx 332
|
||||
+# elif defined __riscv
|
||||
+# define __NR_statx 291
|
||||
# else
|
||||
# warning "__NR_statx not defined for your architecture"
|
||||
# endif
|
||||
diff --git a/src/basic/virt.c b/src/basic/virt.c
|
||||
index 3be3852..72792f5 100644
|
||||
--- a/src/basic/virt.c
|
||||
+++ b/src/basic/virt.c
|
||||
@@ -84,7 +84,7 @@ static int detect_vm_cpuid(void) {
|
||||
}
|
||||
|
||||
static int detect_vm_device_tree(void) {
|
||||
-#if defined(__arm__) || defined(__aarch64__) || defined(__powerpc__) || defined(__powerpc64__)
|
||||
+#if defined(__arm__) || defined(__aarch64__) || defined(__powerpc__) || defined(__powerpc64__) || defined(__riscv)
|
||||
_cleanup_free_ char *hvtype = NULL;
|
||||
int r;
|
||||
|
||||
@@ -127,7 +127,7 @@ static int detect_vm_device_tree(void) {
|
||||
}
|
||||
|
||||
static int detect_vm_dmi(void) {
|
||||
-#if defined(__i386__) || defined(__x86_64__) || defined(__arm__) || defined(__aarch64__)
|
||||
+#if defined(__i386__) || defined(__x86_64__) || defined(__arm__) || defined(__aarch64__) || defined(__riscv)
|
||||
|
||||
static const char *const dmi_vendors[] = {
|
||||
"/sys/class/dmi/id/product_name", /* Test this before sys_vendor to detect KVM over QEMU */
|
||||
diff --git a/src/shared/seccomp-util.c b/src/shared/seccomp-util.c
|
||||
index acfe435..30615c2 100644
|
||||
--- a/src/shared/seccomp-util.c
|
||||
@ -63,6 +152,20 @@ index acfe435..30615c2 100644
|
||||
#warning "Consider adding the right mmap() syscall definitions here!"
|
||||
#endif
|
||||
}
|
||||
diff --git a/src/test/test-execute.c b/src/test/test-execute.c
|
||||
index 435ab39..0aca8ae 100644
|
||||
--- a/src/test/test-execute.c
|
||||
+++ b/src/test/test-execute.c
|
||||
@@ -275,6 +275,9 @@ static void test_exec_personality(Manager *m) {
|
||||
#elif defined(__aarch64__)
|
||||
test(__func__, m, "exec-personality-aarch64.service", 0, CLD_EXITED);
|
||||
|
||||
+#elif defined(__riscv__) && __riscv_xlen == 64
|
||||
+ test(__func__, m, "exec-personality-riscv64.service", 0, CLD_EXITED);
|
||||
+
|
||||
#elif defined(__i386__)
|
||||
test(__func__, m, "exec-personality-x86.service", 0, CLD_EXITED);
|
||||
#else
|
||||
diff --git a/src/test/test-seccomp.c b/src/test/test-seccomp.c
|
||||
index a906070..311283a 100644
|
||||
--- a/src/test/test-seccomp.c
|
||||
@ -95,3 +198,16 @@ index a906070..311283a 100644
|
||||
assert_se(p == MAP_FAILED);
|
||||
assert_se(errno == EPERM);
|
||||
#endif
|
||||
diff --git a/test/test-execute/exec-personality-riscv64.service b/test/test-execute/exec-personality-riscv64.service
|
||||
new file mode 100644
|
||||
index 0000000..ab20396
|
||||
--- /dev/null
|
||||
+++ b/test/test-execute/exec-personality-riscv64.service
|
||||
@@ -0,0 +1,7 @@
|
||||
+[Unit]
|
||||
+Description=Test for Personality=riscv64
|
||||
+
|
||||
+[Service]
|
||||
+ExecStart=/bin/sh -c 'echo $(uname -m); exit $(test $(uname -m) = "riscv64")'
|
||||
+Type=oneshot
|
||||
+Personality=riscv64
|
||||
|
Loading…
Reference in New Issue
Block a user