On Tue, Aug 31, 2021, at 12:07 PM, David Hildenbrand wrote:
On 28.08.21 00:18, Sean Christopherson wrote:
On Thu, Aug 26, 2021, David Hildenbrand wrote:
You'll end up with a VMA that corresponds to the whole file in a single
process only, and that cannot vanish, not even in parts.
How would userspace tell the kernel to free parts of memory that it doesn't want
assigned to the guest, e.g. to free memory that the guest has converted to
not-private?
I'd guess one possibility could be fallocate(FALLOC_FL_PUNCH_HOLE).
Questions are: when would it actually be allowed to perform such a
destructive operation? Do we have to protect from that? How would KVM
protect from user space replacing private pages by shared pages in any
of the models we discuss?
What do you mean? If userspace maliciously replaces a shared page by a private page, then the guest crashes.
(The actual meaning here is a bit different on SNP-ES vs TDX. In SNP-ES, a given GPA can be shared, private, or nonexistent. A guest accesses it with a special bit set in the guest page tables to indicate whether it expects shared or private, and the CPU will produce an appropriate error if the bit doesn't match the page.