Commit c30e000
KVM: x86/mmu: Harden new PGD against roots without shadow pages
Harden kvm_mmu_new_pgd() against NULL pointer dereference bugs by sanity
checking that the target root has an associated shadow page prior to
dereferencing said shadow page. The code in question is guaranteed to
only see roots with shadow pages as fast_pgd_switch() explicitly frees the
current root if it doesn't have a shadow page, i.e. is a PAE root, and
that in turn prevents valid roots from being cached, but that's all very
subtle.
Link: https://lore.kernel.org/r/20230729005200.1057358-3-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>1 parent c5f2d56 commit c30e000
1 file changed
Lines changed: 19 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4527 | 4527 | | |
4528 | 4528 | | |
4529 | 4529 | | |
4530 | | - | |
4531 | | - | |
4532 | | - | |
| 4530 | + | |
| 4531 | + | |
| 4532 | + | |
| 4533 | + | |
| 4534 | + | |
| 4535 | + | |
| 4536 | + | |
| 4537 | + | |
| 4538 | + | |
| 4539 | + | |
| 4540 | + | |
| 4541 | + | |
| 4542 | + | |
4533 | 4543 | | |
4534 | 4544 | | |
4535 | 4545 | | |
| |||
4649 | 4659 | | |
4650 | 4660 | | |
4651 | 4661 | | |
4652 | | - | |
4653 | | - | |
4654 | | - | |
| 4662 | + | |
| 4663 | + | |
| 4664 | + | |
| 4665 | + | |
| 4666 | + | |
| 4667 | + | |
4655 | 4668 | | |
4656 | 4669 | | |
4657 | 4670 | | |
| |||
0 commit comments