diff options
| author | Alexander Potapenko <glider@google.com> | 2024-12-10 13:38:43 +0100 |
|---|---|---|
| committer | Alexander Potapenko <glider@google.com> | 2024-12-11 10:23:54 +0000 |
| commit | 09017703fac0755f8fc6362abe16a3206bccf333 (patch) | |
| tree | 84279d9208c1542dcd605a5d59a24dbadc4a84ea /executor/common_kvm_arm64.h | |
| parent | cfc402b4e65a6aab3a2555765bda8dc12c99a348 (diff) | |
pkg/vminfo: sys/linux: executor: define syz_kvm_assert_syzos_uexit()
The new pseudo-syscall will serve as a test assertion, checking the uexit
return value. This is going to help us validate SyzOS code.
Diffstat (limited to 'executor/common_kvm_arm64.h')
| -rw-r--r-- | executor/common_kvm_arm64.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/executor/common_kvm_arm64.h b/executor/common_kvm_arm64.h index 66697b2cf..02e84aad8 100644 --- a/executor/common_kvm_arm64.h +++ b/executor/common_kvm_arm64.h @@ -361,3 +361,22 @@ static long syz_kvm_vgic_v3_setup(volatile long a0, volatile long a1, volatile l return vgic_fd; } #endif + +#if SYZ_EXECUTOR || __NR_syz_kvm_assert_syzos_uexit +static long syz_kvm_assert_syzos_uexit(volatile long a0, volatile long a1) +{ + struct kvm_run* run = (struct kvm_run*)a0; + uint64 expect = a1; + + if (!run || (run->exit_reason != KVM_EXIT_MMIO) || (run->mmio.phys_addr != ARM64_ADDR_UEXIT)) { + errno = EINVAL; + return -1; + } + + if ((((uint64*)(run->mmio.data))[0]) != expect) { + errno = EDOM; + return -1; + } + return 0; +} +#endif |
