diff options
Diffstat (limited to 'executor')
| -rw-r--r-- | executor/common_kvm_arm64.h | 19 | ||||
| -rw-r--r-- | executor/common_linux.h | 2 |
2 files changed, 20 insertions, 1 deletions
diff --git a/executor/common_kvm_arm64.h b/executor/common_kvm_arm64.h index 02e84aad8..6feec78ab 100644 --- a/executor/common_kvm_arm64.h +++ b/executor/common_kvm_arm64.h @@ -380,3 +380,22 @@ static long syz_kvm_assert_syzos_uexit(volatile long a0, volatile long a1) 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 diff --git a/executor/common_linux.h b/executor/common_linux.h index e63b0479f..635fc25ad 100644 --- a/executor/common_linux.h +++ b/executor/common_linux.h @@ -3186,7 +3186,7 @@ error_clear_loop: } #endif -#if SYZ_EXECUTOR || __NR_syz_kvm_setup_cpu || __NR_syz_kvm_vgic_v3_setup || __NR_syz_kvm_setup_syzos_vm || __NR_syz_kvm_add_vcpu || __NR_syz_kvm_assert_syzos_uexit +#if SYZ_EXECUTOR || __NR_syz_kvm_setup_cpu || __NR_syz_kvm_vgic_v3_setup || __NR_syz_kvm_setup_syzos_vm || __NR_syz_kvm_add_vcpu || __NR_syz_kvm_assert_syzos_uexit || __NR_syz_kvm_assert_reg // KVM is not yet supported on RISC-V #if !GOARCH_riscv64 && !GOARCH_arm #include <errno.h> |
