Skip to content

Commit ec65632

Browse files
committed
fsverity: use _with_retry
To paper over the fork-vs-fsverity issue a bit more. Signed-off-by: Colin Walters <[email protected]>
1 parent 87e2867 commit ec65632

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

crates/lib/src/cli.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1227,7 +1227,8 @@ async fn run_from_opt(opt: Opt) -> Result<()> {
12271227
FsverityOpts::Enable { path } => {
12281228
let fd =
12291229
std::fs::File::open(&path).with_context(|| format!("Reading {path}"))?;
1230-
fsverity::enable_verity_raw::<fsverity::Sha256HashValue>(&fd)?;
1230+
// Note this is not robust to forks, we're not using the _maybe_copy variant
1231+
fsverity::enable_verity_with_retry::<fsverity::Sha256HashValue>(&fd)?;
12311232
Ok(())
12321233
}
12331234
},

crates/ostree-ext/src/fsverity.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,11 @@ fn enable_fsverity_in_objdir(d: &Dir) -> anyhow::Result<()> {
6565
let enabled =
6666
composefs::fsverity::measure_verity_opt::<Sha256HashValue>(f.as_fd())?.is_some();
6767
if !enabled {
68-
composefs_fsverity::enable_verity_raw::<Sha256HashValue>(&f)?;
68+
// NOTE: We're not using the _with_copy API here because for us it'd require
69+
// copying all the metadata too which is mildly tedious.
70+
// For main composefs we don't need to care about the per-file metadata
71+
// in general which simplifies a lot.
72+
composefs_fsverity::enable_verity_with_retry::<Sha256HashValue>(f.as_fd())?;
6973
}
7074
}
7175
Ok(())

0 commit comments

Comments
 (0)