[RFD] Clear virtual machine memory when virtual machine is turned off
From: fei luo
Date: Thu Dec 02 2021 - 05:42:00 EST
Hi,
When running the kvm virtual machine in Linux, because the virtual
machine may contain sensitive data, the user may not want this
data to remain in the memory after the virtual machine is turned off.
Although this part of memory will be cleared before being reused by
user-mode programs , But the sensitive data staying in the memory
for a long time will undoubtedly increase the risk of information leakage,
So I wonder whether it is possible to add a flag (like MAP_UNMAPZERO)
to the mmap(2) system call to indicate that the mapped memory needs
to be cleared zero when munmap(2) called or when the program exits.
Of course, the page clear operation not only occurs when munmap(2)
called or program exits, but also needs to consider scenes such as
page migration, swap, balloon etc.
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?