aboutsummaryrefslogtreecommitdiffstats
path: root/executor
diff options
context:
space:
mode:
author6eanut <jiakaiPeanut@gmail.com>2026-01-20 09:39:21 +0000
committerAlexander Potapenko <glider@google.com>2026-01-21 11:38:32 +0000
commit6984f21fcb77bdd034a489c0e552aa1d910e852f (patch)
tree72c1aabe2770b18ba1fbb4bcad74259d361bd604 /executor
parentad02db7b6c8ae92053b85c73b7a8f896543e6b4e (diff)
executor, sys/linux, pkg: enable syz_kvm_assert_reg for riscv64
- Enables syz_kvm_assert_reg for riscv64. - Updates kvm_one_reg according to the latest definition in https://github.com/torvalds/linux/blob/master/arch/riscv/include/uapi/asm/kvm.h. - Adds a test case: riscv64-kvm-reg.
Diffstat (limited to 'executor')
-rw-r--r--executor/common_kvm_riscv64.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/executor/common_kvm_riscv64.h b/executor/common_kvm_riscv64.h
index dcccd6dad..500240638 100644
--- a/executor/common_kvm_riscv64.h
+++ b/executor/common_kvm_riscv64.h
@@ -12,6 +12,7 @@
#include <string.h>
#include <sys/ioctl.h>
+#if SYZ_EXECUTOR || __NR_syz_kvm_setup_cpu
struct kvm_text {
uintptr_t type;
const void* text;
@@ -153,5 +154,25 @@ static volatile long syz_kvm_setup_cpu(volatile long a0, volatile long a1, volat
return 0;
}
+#endif
+
+#if SYZ_EXECUTOR || __NR_syz_kvm_assert_reg
+static long syz_kvm_assert_reg(volatile long a0, volatile long a1, volatile long a2)
+{
+ int vcpu_fd = (int)a0;
+ uint64 id = (uint64)a1;
+ uint64 expect = a2, val = 0;
+
+ struct kvm_one_reg reg = {.id = id, .addr = (uint64)&val};
+ int ret = ioctl(vcpu_fd, KVM_GET_ONE_REG, &reg);
+ if (ret)
+ return ret;
+ if (val != expect) {
+ errno = EDOM;
+ return -1;
+ }
+ return 0;
+}
+#endif
#endif // EXECUTOR_COMMON_KVM_RISCV64_H \ No newline at end of file