freenode
Kernel & Low-Level

KVM guest_memfd in-place conversion aims at Linux 7.3

Google posts a revised series to flip private and shared guest pages without reallocating them, plus broader KVM selftests.

Ackerley Tng of Google has posted a revised Linux kernel series that lets KVM convert guest_memfd pages between private and shared state in place, instead of tearing down and reallocating backing memory for each flip. The work targets the soft close for Linux 7.3 and arrives with a much wider set of KVM selftests for confidential-style guests.

guest_memfd is the file-backed store used for protected virtual machine memory, where pages must stay private to the guest or become temporarily shared with the host. In-place conversion keeps the same physical pages while updating that shared-or-private attribute. That path has to unmap any host mappings when memory turns private, refuse conversion while another subsystem still holds a long-term pin, and remember attribute changes even if no pages have been faulted in yet. Getting those rules wrong breaks isolation or stalls guests that rely on frequent sharing for I/O and paravirtual devices.

Tng co-developed the series with Sean Christopherson. The latest posting incorporates a fix so conversion does not proceed while pages are still in use, pulls in related work that stops the guest-memory path from returning extra page references into KVM, and corrects a kernel-parameters documentation mistake. New and updated selftests exercise multi-page regions and correct page indexing, conversions before any allocation, mixed allocated and hole layouts, fallocate hole punches that must not lose tracked state, consistency of shared and private views across a forked process, and expected EAGAIN failures when a page is pinned. Existing private-memory conversion tests were adjusted so their reset sequence still works when private and shared views share the same physical pages.

Tng said the series is based on 7.3-rc2, with roughly three weeks left before the soft close at 7.3-rc5. Testing covered runs both with and without KVM VM memory-attribute support enabled.