KVM unknown exit: only fail after default handler also fails

Qemu default handler covers some corner cases and prints diagnostics.
Failing only afterwards seems to fix a KVM_EXIT_ENTRY_ERROR crash (code 9)
This commit is contained in:
Steffen Schulz 2021-09-02 17:29:06 -07:00
parent 96aac23864
commit 46119f1f2c

View File

@ -2692,12 +2692,13 @@ int kvm_cpu_exec(CPUState *cpu)
#define CONFIG_UNKNOWN_ERROR_IS_PANIC
#ifndef CONFIG_UNKNOWN_ERROR_IS_PANIC
fprintf(stderr, "Unknown exit code (%d) => ABORT\n", run->exit_reason);
assert(false);
ret = kvm_arch_handle_exit(cpu, run);
assert(ret == 0);
#else
debug_fprintf("kvm_arch_handle_exit(%d) => panic\n", run->exit_reason);
ret = kvm_arch_handle_exit(cpu, run);
if (ret != 0)
handle_hypercall_kafl_panic(run, cpu, (uint64_t)run->hypercall.args[0]);
ret = 0;
#endif
#endif
ret = kvm_arch_handle_exit(cpu, run);