From 6984f21fcb77bdd034a489c0e552aa1d910e852f Mon Sep 17 00:00:00 2001 From: 6eanut Date: Tue, 20 Jan 2026 09:39:21 +0000 Subject: 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. --- executor/common_kvm_riscv64.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'executor') 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 #include +#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, ®); + 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 -- cgit mrf-deployment