Skip to content

Commit a2197eb

Browse files
authored
Do one add_seals call, rather than one per flag. (#4366)
When setting up a copy on write image, we add several seals, to prevent the image from being resized or modified. Set all the seals in a single call, rather than doing one call per seal.
1 parent f54ec71 commit a2197eb

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

Cargo.lock

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/runtime/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ cfg-if = "1.0"
2525
backtrace = { version = "0.3.61" }
2626
rand = "0.8.3"
2727
anyhow = "1.0.38"
28-
memfd = { version = "0.4.1", optional = true }
28+
memfd = { version = "0.6.1", optional = true }
2929

3030
[target.'cfg(target_os = "macos")'.dependencies]
3131
mach = "0.3.2"

crates/runtime/src/cow.rs

+6-4
Original file line numberDiff line numberDiff line change
@@ -162,10 +162,12 @@ impl MemoryImage {
162162
// extra-super-sure that it never changes, and because
163163
// this costs very little, we use the kernel's "seal" API
164164
// to make the memfd image permanently read-only.
165-
memfd.add_seal(memfd::FileSeal::SealGrow)?;
166-
memfd.add_seal(memfd::FileSeal::SealShrink)?;
167-
memfd.add_seal(memfd::FileSeal::SealWrite)?;
168-
memfd.add_seal(memfd::FileSeal::SealSeal)?;
165+
memfd.add_seals(&[
166+
memfd::FileSeal::SealGrow,
167+
memfd::FileSeal::SealShrink,
168+
memfd::FileSeal::SealWrite,
169+
memfd::FileSeal::SealSeal,
170+
])?;
169171

170172
Ok(Some(MemoryImage {
171173
fd: FdSource::Memfd(memfd),

0 commit comments

Comments
 (0)