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 #define CONFIG_UNKNOWN_ERROR_IS_PANIC
#ifndef CONFIG_UNKNOWN_ERROR_IS_PANIC #ifndef CONFIG_UNKNOWN_ERROR_IS_PANIC
fprintf(stderr, "Unknown exit code (%d) => ABORT\n", run->exit_reason); fprintf(stderr, "Unknown exit code (%d) => ABORT\n", run->exit_reason);
assert(false);
ret = kvm_arch_handle_exit(cpu, run); ret = kvm_arch_handle_exit(cpu, run);
assert(ret == 0);
#else #else
debug_fprintf("kvm_arch_handle_exit(%d) => panic\n", run->exit_reason); debug_fprintf("kvm_arch_handle_exit(%d) => panic\n", run->exit_reason);
handle_hypercall_kafl_panic(run, cpu, (uint64_t)run->hypercall.args[0]); ret = kvm_arch_handle_exit(cpu, run);
ret = 0; if (ret != 0)
handle_hypercall_kafl_panic(run, cpu, (uint64_t)run->hypercall.args[0]);
#endif #endif
#endif #endif
ret = kvm_arch_handle_exit(cpu, run); ret = kvm_arch_handle_exit(cpu, run);