Fix a long-standing goof in the coalesced IO code, and a lurking bug in kvm_clear_guest(). The following changes since commit 47ac09b91befbb6a235ab620c32af719f8208399: Linux 6.11-rc4 (2024-08-18 13:17:27 -0700) are available in the Git repository at: https://github.com/kvm-x86/linux.git tags/kvm-x86-generic-6.12 for you to fetch changes up to 025dde582bbf31e7618f9283594ef5e2408e384b: KVM: Harden guest memory APIs against out-of-bounds accesses (2024-09-09 20:15:34 -0700) ---------------------------------------------------------------- KVK generic changes for 6.12: - Fix a bug that results in KVM prematurely exiting to userspace for coalesced MMIO/PIO in many cases, clean up the related code, and add a testcase. - Fix a bug in kvm_clear_guest() where it would trigger a buffer overflow _if_ the gpa+len crosses a page boundary, which thankfully is guaranteed to not happen in the current code base. Add WARNs in more helpers that read/write guest memory to detect similar bugs. ---------------------------------------------------------------- Ilias Stamatis (1): KVM: Fix coalesced_mmio_has_room() to avoid premature userspace exit Sean Christopherson (4): KVM: selftests: Add a test for coalesced MMIO (and PIO on x86) KVM: Clean up coalesced MMIO ring full check KVM: Write the per-page "segment" when clearing (part of) a guest page KVM: Harden guest memory APIs against out-of-bounds accesses tools/testing/selftests/kvm/Makefile | 3 + tools/testing/selftests/kvm/coalesced_io_test.c | 236 ++++++++++++++++++++++++ tools/testing/selftests/kvm/include/kvm_util.h | 26 +++ virt/kvm/coalesced_mmio.c | 31 +--- virt/kvm/kvm_main.c | 11 +- 5 files changed, 283 insertions(+), 24 deletions(-) create mode 100644 tools/testing/selftests/kvm/coalesced_io_test.c