No description
Find a file
Sean Christopherson f28e9c7fce KVM: x86/mmu: Fix wrong/misleading comments in TDP MMU fast zap
Fix misleading and arguably wrong comments in the TDP MMU's fast zap
flow.  The comments, and the fact that actually zapping invalid roots was
added separately, strongly suggests that zapping invalid roots is an
optimization and not required for correctness.  That is a lie.

KVM _must_ zap invalid roots before returning from kvm_mmu_zap_all_fast(),
because when it's called from kvm_mmu_invalidate_zap_pages_in_memslot(),
KVM is relying on it to fully remove all references to the memslot.  Once
the memslot is gone, KVM's mmu_notifier hooks will be unable to find the
stale references as the hva=>gfn translation is done via the memslots.
If KVM doesn't immediately zap SPTEs and userspace unmaps a range after
deleting a memslot, KVM will fail to zap in response to the mmu_notifier
due to not finding a memslot corresponding to the notifier's range, which
leads to a variation of use-after-free.

The other misleading comment (and code) explicitly states that roots
without a reference should be skipped.  While that's technically true,
it's also extremely misleading as it should be impossible for KVM to
encounter a defunct root on the list while holding mmu_lock for write.
Opportunistically add a WARN to enforce that invariant.

Fixes: b7cccd397f ("KVM: x86/mmu: Fast invalidation for TDP MMU")
Fixes: 4c6654bd16 ("KVM: x86/mmu: Tear down roots before kvm_mmu_zap_all_fast returns")
Signed-off-by: Sean Christopherson <seanjc@google.com>
Reviewed-by: Ben Gardon <bgardon@google.com>
Message-Id: <20220226001546.360188-4-seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2022-03-08 09:31:18 -05:00
arch KVM: x86/mmu: Fix wrong/misleading comments in TDP MMU fast zap 2022-03-08 09:31:18 -05:00
block block: bio-integrity: Advance seed correctly for larger interval sizes 2022-02-03 21:09:24 -07:00
certs
crypto lib/crypto: blake2s: avoid indirect calls to compression function for Clang CFI 2022-02-04 19:22:32 +01:00
Documentation Merge branch 'kvm-bugfixes' into HEAD 2022-03-04 18:39:29 -05:00
drivers ata fixes for 5.17-rc4 2022-02-07 12:10:35 -08:00
fs NFS Client Bugfixes for Linux 5.17-rc 2022-02-08 12:03:07 -08:00
include mm: vmalloc: introduce array allocation functions 2022-03-08 09:30:17 -05:00
init
ipc ipc/sem: do not sleep with a spin lock held 2022-02-04 09:25:05 -08:00
kernel KVM: x86: allow defining return-0 static calls 2022-02-18 12:44:22 -05:00
lib lib/crypto: blake2s: avoid indirect calls to compression function for Clang CFI 2022-02-04 19:22:32 +01:00
LICENSES
mm mm: use vmalloc_array and vcalloc for array allocations 2022-03-08 09:30:46 -05:00
net NFS Client Bugfixes for Linux 5.17-rc 2022-02-08 12:03:07 -08:00
samples
scripts
security integrity-v5-17-fix 2022-02-07 09:55:14 -08:00
sound
tools Merge branch 'kvm-bugfixes' into HEAD 2022-03-04 18:39:29 -05:00
usr
virt KVM: use __vcalloc for very large allocations 2022-03-08 09:30:57 -05:00
.clang-format
.cocciconfig
.get_maintainer.ignore
.gitattributes
.gitignore
.mailmap
COPYING
CREDITS
Kbuild
Kconfig
MAINTAINERS KVM: s390: MAINTAINERS: promote Claudio Imbrenda 2022-02-11 09:55:53 +01:00
Makefile Linux 5.17-rc3 2022-02-06 12:20:50 -08:00
README

Linux kernel
============

There are several guides for kernel developers and users. These guides can
be rendered in a number of formats, like HTML and PDF. Please read
Documentation/admin-guide/README.rst first.

In order to build the documentation, use ``make htmldocs`` or
``make pdfdocs``.  The formatted documentation can also be read online at:

    https://www.kernel.org/doc/html/latest/

There are various text files in the Documentation/ subdirectory,
several of them using the Restructured Text markup notation.

Please read the Documentation/process/changes.rst file, as it contains the
requirements for building and running the kernel, and information about
the problems which may result by upgrading your kernel.