Re: [RFD] clear virtual machine memory when virtual machine is turned off

From: David Hildenbrand
Date: Fri Dec 03 2021 - 13:20:19 EST


> Yes, this feature needs to consider when page migration, the content
> of the old page needs to be cleared, and the swap space needs to
> be cleared before swap. Of course, for security reasons, swap can be
> prohibited. Here I just listed some of the changes involved, not all
> aspects. This feature is mainly aimed at clearing the memory of
> the virtual machine after shutdown, so it is more aimed at anonymous
> mapping and huge page mapping
>
>>>
>>>
>>> When reusing the page that has been cleared, there is no need to clear it
>>>
>>> again, which also speeds up the memory allocation of user-mode programs.
>>>
>>>
>>> Is this feature feasible?
>>
>> "init_on_free=1" for the system as a whole, which might sounds like what
>> might tackle part of your use case.
>>
>
> This feature is mainly to prevent the used memory information from leaking,
> not to clear the memory before use.

That's the whole purpose of init_on_free -- maybe you should give that a
second look.

I don't think MAP_UNMAPZERO is what we want.

--
Thanks,

David / dhildenb