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:
parent
5aa1540c5d
commit
a38b4c7f17
1 changed files with 2 additions and 1 deletions
|
|
@ -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(())
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue