Hi,
When running the kvm virtual machine in Linux, because the virtual
machine may contain sensitive data, the user may not want these
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 unmap called or when the program exits.
Of course, the page clear operation not only occurs when unmap called
or program exits, but also need 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?