Commit b0c39fd
committed
Revert "KVM: x86/mmu: Introduce a quirk to control memslot zap behavior"
Remove KVM_X86_QUIRK_SLOT_ZAP_ALL, as the code is broken for shadow MMUs,
and the underlying premise is dodgy.
As was tried in commit 4e10313 ("KVM: x86/mmu: Zap only the relevant
pages when removing a memslot"), all shadow pages, i.e. non-leaf SPTEs,
need to be zapped. All of the accounting for a shadow page is tied to the
memslot, i.e. the shadow page holds a reference to the memslot, for all
intents and purposes. Deleting the memslot without removing all relevant
shadow pages, as is done when KVM_X86_QUIRK_SLOT_ZAP_ALL is disabled,
results in NULL pointer derefs when tearing down the VM.
BUG: kernel NULL pointer dereference, address: 00000000000000b0
#PF: supervisor read access in kernel mode
#PF: error_code(0x0000) - not-present page
PGD 6085f43067 P4D 608c080067 PUD 608c081067 PMD 0
Oops: Oops: 0000 [#1] SMP NOPTI
CPU: 79 UID: 0 PID: 187063 Comm: set_memory_regi Tainted: G W 6.11.0-smp--24867312d167-cpl torvalds#395
Tainted: [W]=WARN
Hardware name: Google Astoria/astoria, BIOS 0.20240617.0-0 06/17/2024
RIP: 0010:__kvm_mmu_prepare_zap_page+0x3a9/0x7b0 [kvm]
Code: <48> 8b 8e b0 00 00 00 48 8b 96 e0 00 00 00 48 c1 e9 09 48 29 c8 8b
RSP: 0018:ff314a25b19f7c28 EFLAGS: 00010212
Call Trace:
<TASK>
kvm_arch_flush_shadow_all+0x7a/0xf0 [kvm]
kvm_mmu_notifier_release+0x6c/0xb0 [kvm]
mmu_notifier_unregister+0x85/0x140
kvm_put_kvm+0x263/0x410 [kvm]
kvm_vm_release+0x21/0x30 [kvm]
__fput+0x8d/0x2c0
__se_sys_close+0x71/0xc0
do_syscall_64+0x83/0x160
entry_SYSCALL_64_after_hwframe+0x76/0x7e
Rather than trying to get things functional for shadow MMUs (which
includes nested TDP), scrap the quirk idea, at least for now. In addition
to the function bug, it's not clear that unconditionally doing a targeted
zap for all non-default VM types is actually desirable. E.g. it's entirely
possible that SEV-ES and SNP VMs would exhibit worse performance than KVM's
current "zap all" behavior, or that it's better to do a targeted zap only
in specific situations, etc.
This reverts commit aa8d1f4.
Cc: Kai Huang <[email protected]>
Cc: Rick Edgecombe <[email protected]>
Cc: Yan Zhao <[email protected]>
Signed-off-by: Sean Christopherson <[email protected]>1 parent 54415c6 commit b0c39fd
File tree
4 files changed
+2
-44
lines changed- Documentation/virt/kvm
- arch/x86
- include
- asm
- uapi/asm
- kvm/mmu
4 files changed
+2
-44
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8097 | 8097 | | |
8098 | 8098 | | |
8099 | 8099 | | |
8100 | | - | |
8101 | | - | |
8102 | | - | |
8103 | | - | |
8104 | | - | |
8105 | | - | |
8106 | | - | |
8107 | | - | |
8108 | 8100 | | |
8109 | 8101 | | |
8110 | 8102 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2358 | 2358 | | |
2359 | 2359 | | |
2360 | 2360 | | |
2361 | | - | |
2362 | | - | |
| 2361 | + | |
2363 | 2362 | | |
2364 | 2363 | | |
2365 | 2364 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
439 | 439 | | |
440 | 440 | | |
441 | 441 | | |
442 | | - | |
443 | 442 | | |
444 | 443 | | |
445 | 444 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7049 | 7049 | | |
7050 | 7050 | | |
7051 | 7051 | | |
7052 | | - | |
7053 | | - | |
7054 | | - | |
7055 | | - | |
7056 | | - | |
7057 | | - | |
7058 | | - | |
7059 | | - | |
7060 | | - | |
7061 | | - | |
7062 | | - | |
7063 | | - | |
7064 | | - | |
7065 | | - | |
7066 | | - | |
7067 | | - | |
7068 | | - | |
7069 | | - | |
7070 | | - | |
7071 | | - | |
7072 | | - | |
7073 | | - | |
7074 | | - | |
7075 | | - | |
7076 | | - | |
7077 | | - | |
7078 | | - | |
7079 | | - | |
7080 | | - | |
7081 | 7052 | | |
7082 | 7053 | | |
7083 | 7054 | | |
7084 | | - | |
7085 | | - | |
7086 | | - | |
7087 | | - | |
| 7055 | + | |
7088 | 7056 | | |
7089 | 7057 | | |
7090 | 7058 | | |
| |||
0 commit comments