MCPcopy Create free account
hub / github.com/cloud-hypervisor/cloud-hypervisor / mprotect

Method mprotect

devices/src/pvmemcontrol.rs:474–484  ·  view source on GitHub ↗
(
        &self,
        addr: u64,
        length: u64,
        protection: libc::c_int,
    )

Source from the content-addressed store, hash-verified

472 }
473
474 fn mprotect(
475 &self,
476 addr: u64,
477 length: u64,
478 protection: libc::c_int,
479 ) -> result::Result<(), Error> {
480 // SAFETY: [`base`, `base` + `len`) is guest memory
481 self.operate_on_memory_range(addr, length, |base, len| unsafe {
482 libc::mprotect(base, len, protection)
483 })
484 }
485
486 fn set_vma_anon_name(&self, addr: u64, length: u64, name: u64) -> result::Result<(), Error> {
487 let name = (name != 0).then(|| CString::new(format!("pvmemcontrol-{name}")).unwrap());

Callers 1

process_requestMethod · 0.80

Calls 1

Tested by

no test coverage detected