Skip to content

Commit 2dc50d3

Browse files
croissanneallisonkarlitskaya
authored andcommitted
mount: make fs-verity optional
Signed-off-by: Sanne Raymaekers <[email protected]>
1 parent cb6bfbb commit 2dc50d3

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

crates/composefs/src/mount.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,14 +75,21 @@ pub fn erofs_mount(image: OwnedFd) -> Result<OwnedFd> {
7575
)?)
7676
}
7777

78-
pub fn composefs_fsmount(image: OwnedFd, name: &str, basedir: impl AsFd) -> Result<OwnedFd> {
78+
pub fn composefs_fsmount(
79+
image: OwnedFd,
80+
name: &str,
81+
basedir: impl AsFd,
82+
enable_verity: bool,
83+
) -> Result<OwnedFd> {
7984
let erofs_mnt = prepare_mount(erofs_mount(image)?)?;
8085

8186
let overlayfs = FsHandle::open("overlay")?;
8287
fsconfig_set_string(overlayfs.as_fd(), "source", format!("composefs:{name}"))?;
8388
fsconfig_set_string(overlayfs.as_fd(), "metacopy", "on")?;
8489
fsconfig_set_string(overlayfs.as_fd(), "redirect_dir", "on")?;
85-
fsconfig_set_string(overlayfs.as_fd(), "verity", "require")?;
90+
if enable_verity {
91+
fsconfig_set_string(overlayfs.as_fd(), "verity", "require")?;
92+
}
8693
overlayfs_set_lower_and_data_fds(&overlayfs, &erofs_mnt, Some(&basedir))?;
8794
fsconfig_create(overlayfs.as_fd())?;
8895

crates/composefs/src/repository.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ impl<ObjectID: FsVerityHashValue> Repository<ObjectID> {
396396

397397
pub fn mount(&self, name: &str) -> Result<OwnedFd> {
398398
let image = self.open_image(name)?;
399-
Ok(composefs_fsmount(image, name, self.objects_dir()?)?)
399+
Ok(composefs_fsmount(image, name, self.objects_dir()?, true)?)
400400
}
401401

402402
pub fn mount_at(&self, name: &str, mountpoint: impl AsRef<Path>) -> Result<()> {

0 commit comments

Comments
 (0)