mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
vmm: tighten landlock rule for PmemConfig
when discard_writes is true, only grant read access in landlock Signed-off-by: Andrew Consroe <aconz2@gmail.com>
This commit is contained in:
@@ -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(())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user