Re: [PATCH] drivers/virt: pkvm: Zero and clean memory before sharing it with the host

From: Fuad Tabba

Date: Mon Nov 16 2026 - 11:33:32 EST


On Mon, 16 Nov 2026 at 14:04, Vincent Donnefort <vdonnefort@xxxxxxxxxx> wrote:
[...]
> Ha yes of course, that's the host s2 we are mapping into. And on the guest side,
> we are only changing the software bits, so no CMO. Actually I should have read
> the comment in stage2_map_walker_try_leaf() more carefully.
>
> That said, I wonder if that shouldn't be handled by the hypervisor, just like
> hyp_poison_page() do the cache clean.
>
> That would be slightly slower than letting the guest (who has a mapping already)
> do it, but pKVM is enforcing isolation between host and guest, and it feels like
> it should do it by default no matter the memory transition.

After the discussion on the related thread [1], if we have the zeroing
here, we need the clean here as well. So I think that this patch is
the right fix now.

Cheers,
/fuad


[1] https://lore.kernel.org/all/CA+EHjTywWTaKLtM6OPF_0ETv29-m8JsHdvF3BeW9Xa=h713eEg@xxxxxxxxxxxxxx/


>
> --
> Vincent