diff options
| author | Alexander Potapenko <glider@google.com> | 2026-01-15 10:45:43 +0100 |
|---|---|---|
| committer | Alexander Potapenko <glider@google.com> | 2026-01-16 09:47:24 +0000 |
| commit | 67ef04e1ef9d40a76d1e2cb97ffa3adbfa51bdb5 (patch) | |
| tree | e07f4076ee9eec106b4969694928558aacdc610b /executor/common_kvm_arm64.h | |
| parent | 67945471d459ce8031b65988d49bf03b726ae691 (diff) | |
executor: sys/linux: Add VCPU fd to `syz_kvm_assert_syzos_uexit`
Enhance the debugging capabilities of C reproducers by passing the VCPU
file descriptor to the syz_kvm_assert_syzos_uexit function. With access to
the VCPU fd, the function can now dump the VCPU's register state upon
assertion failure, providing critical context for debugging guest execution
issues.
Diffstat (limited to 'executor/common_kvm_arm64.h')
| -rw-r--r-- | executor/common_kvm_arm64.h | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/executor/common_kvm_arm64.h b/executor/common_kvm_arm64.h index 0663dcd1c..58678a9df 100644 --- a/executor/common_kvm_arm64.h +++ b/executor/common_kvm_arm64.h @@ -362,17 +362,32 @@ static long syz_kvm_vgic_v3_setup(volatile long a0, volatile long a1, volatile l #endif #if SYZ_EXECUTOR || __NR_syz_kvm_assert_syzos_uexit -static long syz_kvm_assert_syzos_uexit(volatile long a0, volatile long a1) +static long syz_kvm_assert_syzos_uexit(volatile long a0, volatile long a1, + volatile long a2) { - struct kvm_run* run = (struct kvm_run*)a0; - uint64 expect = a1; +#if !SYZ_EXECUTOR + int cpufd = (int)a0; +#endif + struct kvm_run* run = (struct kvm_run*)a1; + uint64 expect = a2; - if (!run || (run->exit_reason != KVM_EXIT_MMIO) || (run->mmio.phys_addr != ARM64_ADDR_UEXIT)) { + if (!run || (run->exit_reason != KVM_EXIT_MMIO) || + (run->mmio.phys_addr != ARM64_ADDR_UEXIT)) { +#if !SYZ_EXECUTOR + fprintf(stderr, "[SYZOS-DEBUG] Assertion Triggered on VCPU %d\n", cpufd); +#endif errno = EINVAL; return -1; } - if ((((uint64*)(run->mmio.data))[0]) != expect) { + uint64_t actual_code = ((uint64_t*)(run->mmio.data))[0]; + if (actual_code != expect) { +#if !SYZ_EXECUTOR + fprintf(stderr, "[SYZOS-DEBUG] Exit Code Mismatch on VCPU %d\n", cpufd); + fprintf(stderr, " Expected: 0x%lx\n", (unsigned long)expect); + fprintf(stderr, " Actual: 0x%lx\n", + (unsigned long)actual_code); +#endif errno = EDOM; return -1; } @@ -399,4 +414,4 @@ static long syz_kvm_assert_reg(volatile long a0, volatile long a1, volatile long } #endif -#endif // EXECUTOR_COMMON_KVM_ARM64_H
\ No newline at end of file +#endif // EXECUTOR_COMMON_KVM_ARM64_H |
