mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-10-28 07:33:09 +00:00
vmm: memory_manager: Mark guest memory mappings as non-dumpable
Including the guest RAM (or other mapped memory) in a coredump is not useful. See: #5014 Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
parent
2b92a2778b
commit
795f2a5558
@ -1580,6 +1580,20 @@ impl MemoryManager {
|
|||||||
.create_user_memory_region(mem_region)
|
.create_user_memory_region(mem_region)
|
||||||
.map_err(Error::CreateUserMemoryRegion)?;
|
.map_err(Error::CreateUserMemoryRegion)?;
|
||||||
|
|
||||||
|
// SAFETY: the address and size are valid since the
|
||||||
|
// mmap succeeded.
|
||||||
|
let ret = unsafe {
|
||||||
|
libc::madvise(
|
||||||
|
userspace_addr as *mut libc::c_void,
|
||||||
|
memory_size as libc::size_t,
|
||||||
|
libc::MADV_DONTDUMP,
|
||||||
|
)
|
||||||
|
};
|
||||||
|
if ret != 0 {
|
||||||
|
let e = io::Error::last_os_error();
|
||||||
|
warn!("Failed to mark mappin as MADV_DONTDUMP: {}", e);
|
||||||
|
}
|
||||||
|
|
||||||
// Mark the pages as mergeable if explicitly asked for.
|
// Mark the pages as mergeable if explicitly asked for.
|
||||||
if mergeable {
|
if mergeable {
|
||||||
// SAFETY: the address and size are valid since the
|
// SAFETY: the address and size are valid since the
|
||||||
|
Loading…
Reference in New Issue
Block a user