Commit 043098e
committed
fix(vcpu): Don't treat KVM_EXIT_{SHUTDOWN,HLT} as successful termination
This is almost a pure revert of commit 3a9a1ac ("exit with success
code on certain KVM_EXIT events") which added code that treats
KVM_EXIT_SHUTDOWN and KVM_EXIT_HLT as successful VM terminations.
KVM_EXIT_SHUTDOWN is an exit code that KVM uses when an x86 CPU triple
faults.
KVM_EXIT_HLT is the exit code that KVM uses when the guest executes a
HALT x86 instruction and KVM doesn't emulate the irqchip. Since we're
using the in-kernel irqchip we should never see a KVM_EXIT_HLT exit, as
HALT instructions are emulated by KVM and do not cause userspace exits.
Do not return Ok(VcpuEmulation::Stopped) for these exit types since that
ends up propagating an FcExitCode::Ok code to the main thread, even
though these are abnormal terminations (especially the triple-fault
one).
Remove special handling for these x86-specific exit reasons and treat
them as any other unexpected exit reason.
Also, replace an incorrect comment that says that vCPUs exit with
KVM_EXIT_SHUTDOWN or KVM_EXIT_HLT when the guest issues a reboot. On x86
the guest asks for a CPU reset via the i8042 controller which
Firecracker intercepts and kills the VM. On ARM KVM exits to userspace
with the reason KVM_EXIT_SYSTEM_EVENT (which we already handle
correctly).
Fixes: 3a9a1ac ("exit with success code on certain KVM_EXIT events")
Signed-off-by: Ilias Stamatis <[email protected]>1 parent 2c2b2c0 commit 043098e
1 file changed
+14
-14
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
226 | 226 | | |
227 | 227 | | |
228 | 228 | | |
229 | | - | |
230 | | - | |
231 | | - | |
232 | | - | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
233 | 232 | | |
234 | 233 | | |
235 | 234 | | |
| |||
440 | 439 | | |
441 | 440 | | |
442 | 441 | | |
443 | | - | |
444 | | - | |
445 | | - | |
446 | | - | |
447 | | - | |
448 | | - | |
449 | | - | |
450 | | - | |
451 | 442 | | |
452 | 443 | | |
453 | 444 | | |
| |||
697 | 688 | | |
698 | 689 | | |
699 | 690 | | |
700 | | - | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
701 | 695 | | |
702 | 696 | | |
703 | | - | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
704 | 704 | | |
705 | 705 | | |
706 | 706 | | |
| |||
0 commit comments