Commit 11d4517
KVM: x86/mmu: Warn if PFN changes on shadow-present SPTE in shadow MMU
Warn if PFN changes on shadow-present SPTE in mmu_set_spte().
KVM should _never_ change the PFN of a shadow-present SPTE. In
mmu_set_spte(), there is a WARN_ON_ONCE() on pfn changes on shadow-present
SPTE in mmu_spte_update() to detect this condition. However, that
WARN_ON_ONCE() is not hittable since mmu_set_spte() invokes drop_spte()
earlier before mmu_spte_update(), which clears SPTE to a !shadow-present
state. So, before invoking drop_spte(), add a WARN_ON_ONCE() in
mmu_set_spte() to warn PFN change of a shadow-present SPTE.
For the spurious prefetch fault, only return RET_PF_SPURIOUS directly when
PFN is not changed. When PFN changes, fall through to follow the sequence
of drop_spte(), warn of PFN change, make_spte(), flush tlb, rmap_add().
Signed-off-by: Yan Zhao <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Sean Christopherson <[email protected]>1 parent 988da78 commit 11d4517
1 file changed
+3
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3020 | 3020 | | |
3021 | 3021 | | |
3022 | 3022 | | |
3023 | | - | |
| 3023 | + | |
| 3024 | + | |
3024 | 3025 | | |
3025 | 3026 | | |
3026 | 3027 | | |
| |||
3034 | 3035 | | |
3035 | 3036 | | |
3036 | 3037 | | |
3037 | | - | |
| 3038 | + | |
3038 | 3039 | | |
3039 | 3040 | | |
3040 | 3041 | | |
| |||
0 commit comments