diff --git a/vmm/src/vm_config.rs b/vmm/src/vm_config.rs index 93304e47d..1888b90b3 100644 --- a/vmm/src/vm_config.rs +++ b/vmm/src/vm_config.rs @@ -486,7 +486,8 @@ pub struct PmemConfig { impl ApplyLandlock for PmemConfig { fn apply_landlock(&self, landlock: &mut Landlock) -> LandlockResult<()> { - landlock.add_rule_with_access(self.file.to_path_buf(), "rw")?; + let access = if self.discard_writes { "r" } else { "rw" }; + landlock.add_rule_with_access(self.file.to_path_buf(), access)?; Ok(()) } }