Repository navigation
Update erofs snapshotter to record blob source - #14107
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
The parentless mount path in the EROFS snapshotter drops uidmap/gidmap mount options when remapIDs is enabled, which can break user-namespace-remapped snapshots.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR changes the EROFS snapshotter’s layer-content-cache fast path from “symlink cached blob into the snapshot directory” to “record the blob’s source in snapshot labels and mount it from its source location,” reducing the risk of accidental writes to operator-owned shared cache blobs. It also updates the EROFS differ to refuse applying into read-only (already-populated) snapshots and expands test coverage around cached-layer staging in both parallel and sequential unpack modes.
Changes:
- Record cached blob provenance via private snapshot labels and resolve/mount cached blobs from their original cache location (no snapshot-directory aliasing).
- Refuse
Applyinto read-only mounts (treated as already-populated content) usingErrFailedPreconditionto avoid differ fallthrough. - Update and extend tests across snapshotter mounting, cache behavior, and unpacker staged-layer handling (parallel + sequential).
File summaries
| File | Description |
|---|---|
| plugins/snapshots/erofs/plugin/plugin.go | Updates config documentation to reflect new “record + mount from cache” behavior and safety expectations. |
| plugins/snapshots/erofs/erofs.go | Implements blob-source recording/resolution, new mount assembly flow, and label-carrying across Commit/Update. |
| plugins/snapshots/erofs/erofs_linux_test.go | Updates/extends snapshotter tests for cache mounting, stale cache errors, and label persistence. |
| plugins/snapshots/erofs/blobsource.go | Introduces blob source label schema and resolution logic (local vs cache). |
| plugins/snapshots/erofs/blobsource_test.go | Adds unit tests for blob source parsing, private-label selection, and resolution behavior. |
| plugins/diff/erofs/differ.go | Refuses applying into read-only (already populated) snapshots with ErrFailedPrecondition. |
| plugins/diff/erofs/differ_test.go | Adds tests ensuring read-only mounts are refused and don’t fall through to other differs. |
| internal/erofsutils/mount_test.go | Adds test coverage for resolving an EROFS layer directory from mounts. |
| core/unpack/unpacker_test.go | Adds staged-layer coverage for sequential mode and refactors staged unpack helper. |
Review details
Suppressed comments (1)
plugins/snapshots/erofs/erofs.go:618
- In the parentless non-block-mode path, the bind mount options no longer include uidmap/gidmap when remapIDs is enabled (unlike plugins/snapshots/overlay/overlay.go:555-583). This can cause incorrect ownership semantics for user-namespace-remapped snapshots that rely on idmapped mounts.
return []mount.Mount{
{
Source: s.upperPath(snap.ID),
Type: "bind",
Options: []string{roFlag, "rbind"},
},
- Files reviewed: 9/9 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| Source: "{{ mount 0 }}/upper", | ||
| Type: "format/mkdir/bind", | ||
| Options: append(options, | ||
| Options: []string{ | ||
| "X-containerd.mkdir.path={{ mount 0 }}/upper:0755", | ||
| roFlag, |
a244f85 to
4aa17a3
Compare
There was a problem hiding this comment.
🔵 Needs a closer look
It changes snapshot mount/commit semantics across multiple codepaths (snapshotter, differ, unpacker) and warrants final human validation of compatibility and operational behavior.
Review details
- Files reviewed: 9/9 changed files
- Comments generated: 2
- Review effort level: Lite
4aa17a3 to
a688f71
Compare
There was a problem hiding this comment.
🟡 Changes recommended
It introduces concrete correctness and safety issues (symlink-following in blob resolution/removal, missing uidmap/gidmap options in bind-mount fallbacks, and masked ErrNotImplemented in Commit) that should be fixed before approval.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
Suppressed comments (3)
plugins/snapshots/erofs/erofs.go:945
- If commitBlock returns ErrNotImplemented (e.g., non-Linux builds where convertDirToErofs is stubbed), Commit currently returns errNoLayerBlob instead, masking the real capability error. Prefer returning the conversion error (cerr) so callers get ErrNotImplemented rather than an internal sentinel.
if cerr := s.commitBlock(ctx, layerBlob, id); cerr != nil {
if errdefs.IsNotImplemented(cerr) {
return err
}
return cerr
plugins/snapshots/erofs/erofs.go:609
- The bind-mount fallback in blockMode drops uidmap/gidmap mount options (snapshots.LabelSnapshotUIDMapping / GIDMapping). The overlay snapshotter applies these options even for the bind-mount path (plugins/snapshots/overlay/overlay.go:555-583); without them, remapped-ID snapshots can behave incorrectly when ParentIDs==0.
{
Source: "{{ mount 0 }}/upper",
Type: "format/mkdir/bind",
Options: []string{
"X-containerd.mkdir.path={{ mount 0 }}/upper:0755",
plugins/snapshots/erofs/erofs.go:621
- The no-parent non-blockMode bind-mount fallback drops uidmap/gidmap mount options (snapshots.LabelSnapshotUIDMapping / GIDMapping), unlike the overlay snapshotter (plugins/snapshots/overlay/overlay.go:555-583). This can break remapped-ID snapshots when ParentIDs==0.
return []mount.Mount{
{
Source: s.upperPath(snap.ID),
Type: "bind",
Options: []string{roFlag, "rbind"},
},
- Files reviewed: 9/9 changed files
- Comments generated: 2
- Review effort level: Lite
a688f71 to
a4e220d
Compare
There was a problem hiding this comment.
🔵 Needs a closer look
Unresolved issues remain in differ classification, shared-cache usage accounting, and fs-verity handling.
Review details
Suppressed comments (3)
plugins/diff/erofs/differ.go:138
- This check now runs before
erofsutils.MountsToLayercan identify whether the target is an EROFS snapshot. If the diff service is configured witherofsbeforewalking, a read-only bind/overlay mount from another snapshotter is reported asErrFailedPreconditioninstead of returningErrNotImplemented, so the appropriate differ cannot be selected. Restrict the refusal to a mount shape/source that identifies an EROFS cache-served snapshot (or otherwise preserve the unsupported result for non-EROFS mounts).
if len(mounts) > 0 && mounts[len(mounts)-1].ReadOnly() {
return emptyDesc, fmt.Errorf("cannot apply to a read-only snapshot, its content is already populated: %w", errdefs.ErrFailedPrecondition)
plugins/snapshots/erofs/erofs.go:981
- Because
layerBlobis now allowed to point outside the snapshot, this walks and charges the full cache file (including its inode) to every snapshot that references it. That shared file is not removed when any of those snapshots is removed, so image usage and any quota/GC decisions based onsnapshots.Usagewill overcount the resources attributable to the snapshot. Report only snapshot-owned usage or introduce shared-cache accounting before persisting this value.
// TODO: a blob this snapshot does not own is counted in full here, even
// though removing the snapshot reclaims none of it. Usage means
// different things to different callers (what the snapshot occupies on
// disk, what deleting it would free, how shared bytes are attributed),
// so reporting it correctly needs its own design rather than a special
// case here.
plugins/snapshots/erofs/erofs.go:575
srcis discarded here, so a cache-backed active snapshot is subjected toverifyFsveritywhenever the daemon is restarted withenable_fsveritybut withoutlayer_content_caches. The startup check only rejects enabling both options in the same process; recorded cache sources can outlive that configuration, and their integrity is handled by dm-verity rather than fs-verity. Gate this verification onsrc.owned()asCommitdoes, otherwise a valid cached layer becomes unmountable after a configuration change.
if s.enableFsverity {
- Files reviewed: 9/9 changed files
- Comments generated: 0 new
- Review effort level: Lite
Staging a cached layer blob was gated on the Prepare having no parent, which sequential unpacking only does for the first layer, so a warm cache missed on every layer but layer 0 and a pull ended up slower than with no cache at all. Serve any image-layer extraction, and mount a staged blob read-only whatever its parents, so the differ is never handed a writable view of a blob shared with every other snapshot of that layer. A read-only mount is a report to the caller and not an enforcement, so the erofs differ also refuses a layer whose blob is a symlink, which would otherwise truncate the cache entry through it. Signed-off-by: Maksym Pavlenko <[email protected]>
a4e220d to
65d874b
Compare
There was a problem hiding this comment.
🟡 Changes recommended
A critical cached-blob device identity and lifetime issue remains, along with additional correctness findings.
Get a fresh assessment by requesting another Copilot review.
Review details
Suppressed comments (4)
plugins/snapshots/erofs/blobsource.go:166
os.Statsucceeding is not enough to establish that a cache entry is an EROFS blob: a directory, FIFO, or other non-regular object is accepted as populated here.lookupCachelikewise treats any successful stat as a hit, so such an entry makes the unpacker skip apply and can be committed even though the later mount cannot use it. Requirefi.Mode().IsRegular()and reject malformed entries with a precondition error before returning the source.
if _, err := os.Stat(src.Ref); err != nil {
return "", src, fmt.Errorf("layer blob %q from the %s is unusable: %w", src.Ref, src.Kind, err)
}
return src.Ref, src, nil
plugins/snapshots/erofs/erofs.go:982
- Now that
layerBlobis the external cache path,fs.DiskUsagecharges the shared cache file to every committed snapshot even thoughRemovenever reclaims it. Images sharing a cached layer will therefore overstate snapshot resource usage (and the stored Usage value is not what the snapshot owns); exclude non-owned blobs or define separate shared-cache accounting before persisting this value.
// TODO: a blob this snapshot does not own is counted in full here, even
// though removing the snapshot does not reclaim any of it. Usage has
// several meanings (bytes on disk, bytes a deletion would free,
// attribution of shared bytes), and choosing one needs its own
// design.
plugins/snapshots/erofs/erofs.go:788
- If the cache entry is removed after
lookupCachebut before this call,s.mountsnow returns an error after the storage transaction has already committed the active snapshot. The defer above removes only the filesystem path; it never removes the metadata record, and the caller gets thePrepareerror before the unpacker installs its abort cleanup. This leaves an orphaned active snapshot in the backend metadata. The post-rename failure path needs to abort/remove the storage snapshot as well (or resolve all recorded sources before committing it).
return s.mounts(snap, info, parents)
plugins/snapshots/erofs/erofs.go:680
- This preflight turns every
Statfailure into a "has no .dmverity metadata" error, including permission errors and I/O failures. That is misleading and differs fromapplyDmverityPolicy, which distinguishes missing metadata from failures to access it; preserve the actual failure class so an unreadable cache is diagnosable.
if _, err := os.Stat(dmverity.MetadataPath(cacheBlob)); err != nil {
return nil, fmt.Errorf("dm-verity mode is 'on' but the layer content cache entry %q has no .dmverity metadata: %w", cacheBlob, err)
- Files reviewed: 9/9 changed files
- Comments generated: 1
- Review effort level: Lite
| m, err := s.createErofsMount(layerBlob) | ||
| if err != nil { | ||
| return nil, fmt.Errorf("failed to create erofs mount: %w", err) |
| // An erofs mount is read-only whatever its options say (see | ||
| // mount.Mount.ReadOnly). |
There was a problem hiding this comment.
"All erofs mounts are read-only"
| // labelPrefix namespaces the labels the snapshotter records about a snapshot | ||
| // for its own use. | ||
| // | ||
| // The prefix sits outside "containerd.io/snapshot/", whose labels are inherited | ||
| // from image annotations (see snapshots.FilterInheritedLabels): a manifest could | ||
| // otherwise claim its layer lives at any path on the host. The same filter runs | ||
| // on everything the metadata snapshotter passes down, so a client cannot set or | ||
| // clear these labels either. They stay readable: Stat and Walk report the | ||
| // backend's labels alongside the metadata store's. |
There was a problem hiding this comment.
I think the comments in this file would benefit from a rewrite by the writing-review skill in https://github.com/samuelkarp/skills.
| case blobSourceLocal: | ||
| if src.Ref != "" { | ||
| return blobSource{}, fmt.Errorf("snapshot %q records a layer blob ref with no source", info.Name) | ||
| } | ||
| return blobSource{}, nil | ||
| case blobSourceCache: | ||
| if src.Ref == "" { | ||
| return blobSource{}, fmt.Errorf("snapshot %q records a %s layer blob with no ref", info.Name, src.Kind) | ||
| } | ||
| return src, nil |
There was a problem hiding this comment.
Seems like these should have the same error, using %s with src.Kind. Like case blobSourceLocal, blobSourceCache:. The branches don't seem meaningfully different.
The differ found an already-populated snapshot by looking for a symlinked layer.erofs in the layer directory. That check needs a particular on-disk layout, and it needs erofsutils.MountsToLayer to infer the snapshot directory from a mount source that lives inside it. Neither holds for a snapshot whose content is not a local file. Refuse on the signal the unpacker already uses. Mounts handed to Apply that are read-only belong to a snapshot the snapshotter populated itself, whose content is shared with every other snapshot of that layer. This does not need path inference, covers parented and parentless snapshots alike, and stays correct for any content the snapshotter does not store as a plain file in the snapshot directory. The error stays ErrFailedPrecondition. plugins/services/diff/local.go falls through to the next differ on ErrNotImplemented. Another differ would fail on this layer for the same reason. Signed-off-by: Derek McGowan <[email protected]>
65d874b to
4cf8e82
Compare
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved correctness issues remain in dm-verity sharing, differ detection, blob validation, accounting, and cleanup.
Get a fresh assessment by requesting another Copilot review.
Review details
Suppressed comments (5)
plugins/diff/erofs/differ.go:140
- This guard runs before the differ verifies that the mount set is an EROFS layer. A read-only bind or other read-only mount from another snapshotter is therefore reported as
ErrFailedPrecondition; the diff service treats that as handled and will not try a later differ. Restrict the guard to mount shapes this differ supports (while still covering cached EROFS mounts), and returnErrNotImplementedfor unrelated mounts.
if len(mounts) > 0 && mounts[len(mounts)-1].ReadOnly() {
return emptyDesc, fmt.Errorf("cannot apply to a read-only snapshot, its content is already populated: %w", errdefs.ErrFailedPrecondition)
plugins/snapshots/erofs/erofs.go:975
- For a cache-backed snapshot,
layerBlobis a shared external file, but this records its fullDiskUsagein every committed snapshot. Image usage and any quota/accounting based on snapshot usage will multiply-charge bytes that removing any one snapshot cannot reclaim. Do not attribute the external shared blob as per-snapshot reclaimable usage, or add deduplicated ownership accounting before persisting this value.
// TODO: a blob this snapshot does not own is counted in full here, even
// though removing the snapshot does not reclaim any of it. Usage has
// several meanings: bytes on disk, bytes a deletion would free, and
// attribution of shared bytes. Choosing one needs its own design.
usage, err := fs.DiskUsage(ctx, layerBlob)
plugins/snapshots/erofs/erofs.go:673
- In
dmverity_mode="on", everyStatfailure is reported as missing metadata. Permission or I/O failures are different fromENOENT, andapplyDmverityPolicybelow already preserves that distinction; collapsing them here misdiagnoses operational failures and obscures the real cause. Preserve non-os.ErrNotExisterrors separately from the missing-sidecar message.
if _, err := os.Stat(dmverity.MetadataPath(cacheBlob)); err != nil {
return nil, fmt.Errorf("dm-verity mode is 'on' but the layer content cache entry %q has no .dmverity metadata: %w", cacheBlob, err)
plugins/snapshots/erofs/erofs.go:937
- When conversion returns
ErrNotImplemented, this returns the earlierresolveBloberror (errNoLayerBlob) instead of the conversion error. Callers therefore see a missing layer rather than the actual unsupported-conversion result, and the intended error classification is lost.
if errdefs.IsNotImplemented(cerr) {
return err
plugins/snapshots/erofs/erofs.go:781
- After the backend record is created and the temporary directory is renamed, an error from
s.mounts(for example, a cache entry pruned in the lookup-to-mount window) reaches this cleanup but only removes the filesystem directory. The active storage record remains unpublished by the metadata wrapper, so repeated failures accumulate unreachable snapshot records that cleanup cannot remove through a user key. Roll back the storage record as part of post-renamecreateSnapshotfailure cleanup.
return s.mounts(snap, info, parents)
- Files reviewed: 10/10 changed files
- Comments generated: 2
- Review effort level: Lite
A layer served from the layer content cache was symlinked into the snapshot as its layer.erofs. That put a path inside the snapshot directory aliasing a blob owned by the operator and shared with every other snapshot of that layer. Everything written to that path went straight into the cache entry. Each write site then needed its own guard: the differ had to refuse to apply, Commit had to refuse to convert through a dangling link, and Remove had to avoid clearing IMMUTABLE_FL on a file it did not own. A missed guard corrupted content shared across images. A pruned entry left a dangling link that read as an absent blob on one path and as populated content on another. Record where the blob is on the snapshot and mount it from there. Nothing in the snapshot directory refers to content it does not own. A stray write creates a local file, conversion cannot reach the cache, and removal has nothing to follow. The guards Commit and Remove needed for a symlink are gone. The differ still refuses, on the read-only mounts the snapshotter hands out. resolveBlob is the one place a blob is located. It reports whether the blob is already populated, meaning there is nothing to apply or convert, and whether it belongs to this snapshot, meaning it may be written. Mounts are then assembled without consulting the filesystem to find out what a layer is. A source that does not resolve is an error on every path, including the parentless path in mounts(). A flattened parent's device= is resolved the same way. fsverity is only measured for a blob the snapshot owns. Measuring a cache entry would require the operator to enable fsverity on content this snapshotter never wrote. NewSnapshotter already rejects fsverity together with the layer content cache. The record is kept in labels outside the containerd.io/snapshot/ namespace. Labels in that namespace are inherited from image annotations, which would let an image name any path on the host. The same filter runs on everything the metadata snapshotter passes down. A client cannot set these labels, and cannot send them back after reading them through Stat. Commit and Update carry them across. The dm-verity sidecar is read from beside the cache entry. Nothing is copied into the snapshot. The sidecar cannot fall out of step with the blob it pins. An entry required to have one is rejected at Prepare. Signed-off-by: Derek McGowan <[email protected]>
The mount handler built the device name from the source path, taking the base of the parent directory as a snapshot id. That reads an identity out of a layout only a snapshot directory has. A layer served from a layer content cache is mounted from the cache, whose parent directory is a shard named for the first two characters of the digest. Every blob in a shard then names one device. A second layer in a shard fails to mount. dmverity.Open finds the name taken, VerifyDevice compares the existing device's root hash against the one being mounted, and the mismatch is an error. No layer is served against the wrong root hash, and none of the colliding layers can be mounted. Name the device for the source and the mount point together. Mount closes the device it creates when the mount fails, so the name has to be unique to the mount. Neither half is unique alone: a cache serves one blob to every snapshot of that layer, and a mount point is reused once the mount before it is gone. A device left behind by a crash is reused only for the same blob in the same place, where its root hash still matches. Unmount reads the name back from the mounted source and needs nothing from either. Signed-off-by: Derek McGowan <[email protected]>
4cf8e82 to
697a757
Compare
There was a problem hiding this comment.
🔵 Needs a closer look
Three moderate findings remain unresolved around legacy mapper cleanup, metadata rollback, and shared-blob usage accounting.
Review details
Suppressed comments (3)
plugins/mount/erofs/plugin_linux.go:174
- This changes the mapper name from the previous
containerd-erofs-<snapshotID>scheme to a source/mountpoint hash, but there is no migration or startup cleanup for legacy names. If the daemon dies after creating a legacy dm-verity device and before activation is persisted, the old mapper survives while the new code will never select or close it, leaking devices across an upgrade. Please retain a compatibility cleanup path for the old names when changing the naming scheme.
func dmverityDeviceName(source, mountpoint string) string {
sum := sha256.Sum256([]byte(source + "\x00" + mountpoint))
return fmt.Sprintf("containerd-erofs-%x", sum[:16])
plugins/snapshots/erofs/erofs.go:673
- If the cache entry (or its required sidecar) disappears after the precheck but before
s.mountsresolves it,storage.CreateSnapshothas already committed the backend active record and renamedpath. The error cleanup below removes only the directory, not that metadata record, leaving an orphaned active snapshot in the backend; a malformed cache entry such as a directory deterministically hits the same path. Please roll back/remove the backend snapshot whenever mount resolution fails after the transaction (or resolve the mounts before committing the transaction).
if _, err := os.Stat(dmverity.MetadataPath(cacheBlob)); err != nil {
return nil, fmt.Errorf("dm-verity mode is 'on' but the layer content cache entry %q has no .dmverity metadata: %w", cacheBlob, err)
plugins/snapshots/erofs/erofs.go:974
- Because
layerBlobis a shared cache path in this branch, thefs.DiskUsageresult is persisted as the committed snapshot's full usage. Every snapshot/image referring to the same cache file is therefore charged its bytes (and inode), although removing one snapshot frees none;core/images/usage/calculator.go:123-130consumes this value for image sizing. The TODO documents the mismatch but does not prevent the current over-accounting, so this needs shared-byte accounting or an explicit non-owning usage value.
// TODO: a blob this snapshot does not own is counted in full here, even
// though removing the snapshot does not reclaim any of it. Usage has
// several meanings: bytes on disk, bytes a deletion would free, and
// attribution of shared bytes. Choosing one needs its own design.
- Files reviewed: 11/11 changed files
- Comments generated: 0 new
- Review effort level: Lite
containerd 2.4.0 Created-by: HarmonybrewBot Commit-by: HarmonybrewBot Merged-by: HarmonybrewBot Description: Created by `brew bump` --- Created with `brew bump-formula-pr`.<details> <summary>release notes</summary> <pre>Welcome to the v2.4.0 release of containerd! containerd 2.4 is a regular (non-LTS) release with a shorter support window, intended for users who want to adopt new features sooner. As the release following the 2.3 LTS, it is the point in the release cycle where previously deprecated features may be removed, so this release may include breaking changes; check the notes below and clear any deprecation warnings from your current version before upgrading. Users prioritizing stability and a longer support lifecycle should stay on the 2.3 LTS release. ### Highlights #### Container Runtime Interface (CRI) * Enable mount manager for image mounts in CRI ([#13542](containerd/containerd#13542)) * Export sandbox image and CNI directory configuration in CRI plugin info ([#13940](containerd/containerd#13940)) * Set default runtimeFeatures.UserNamespacesHostNetwork to true ([#13162](containerd/containerd#13162)) * Support OCI runtime feature introspection for non-runc runtimes ([#13504](containerd/containerd#13504)) #### Image Distribution * Apply hardening to strip sensitive authentication headers when fetching descriptor URLs ([#12889](containerd/containerd#12889)) * Support propagating HTTP 299 warning headers from registries to the resolver ([#12698](containerd/containerd#12698)) * Use klauspost/compress for gzip layer decompression ([#13560](containerd/containerd#13560)) #### Image Storage * Add client options to fetch all layer content during unpack even when snapshots exist ([#14126](containerd/containerd#14126)) * Include media type in content create events ([#13833](containerd/containerd#13833)) * Add forward References to the GC collection context ([#13634](containerd/containerd#13634)) #### Node Resource Interface (NRI) * Expose container image name, digest, and config digest to NRI plugins ([#13960](containerd/containerd#13960)) * Emit deprecation warnings for plugins using deprecated NRI interfaces ([#13916](containerd/containerd#13916)) #### Runtime * Mask /proc/interrupts and CPU thermal throttle sysfs paths in Linux containers by default ([#14090](containerd/containerd#14090)) * Add UpdateSandbox RPC to propagate sandbox controller updates to the shim ([#14105](containerd/containerd#14105)) * Avoid immediately restarting containers with restart=always policy after they are explicitly stopped ([#13993](containerd/containerd#13993)) * Pass tracing context from shim to runc and hooks ([#14036](containerd/containerd#14036)) * Fix user and group lookup failures in container rootfs containing symlinked /etc/passwd or /etc/group ([#13818](containerd/containerd#13818)) * Implement Windows named-pipe server and log streaming support in pkg/shim ([#13948](containerd/containerd#13948)) * Enable log scrubbing by default on Windows ([#13837](containerd/containerd#13837)) * Allow specifying parent checkpoint directory when checkpointing with runc ([#13699](containerd/containerd#13699)) #### Snapshotters * Add Prometheus metrics for EROFS snapshotter layer content cache ([#13941](containerd/containerd#13941)) * Support warm image cache for erofs snapshotter ([#13813](containerd/containerd#13813)) * Add max size label for snapshots ([#13520](containerd/containerd#13520)) #### Breaking * Remove deprecated CRI and tracing configuration options: * Remove `enable_cdi` in CRI runtime configuration (CDI is now always enabled) * Remove `bin_dir` in CRI CNI configuration (use `bin_dirs`) * Remove `endpoint`, `protocol`, and `insecure` in OTLP tracing processor configuration (use standard OTLP environment variables) * Remove `service_name` and `sampling_ratio` in internal tracing configuration (use standard OpenTelemetry environment variables) ([#14166](containerd/containerd#14166)) * Remove restore in CreateContainer ([#13871](containerd/containerd#13871)) #### Deprecations * Deprecate containerd.io/runtime-allow-mounts shim annotation in favor of MountCapabilities bootstrap extension ([#14002](containerd/containerd#14002)) * Remove deprecated shim.Command from pkg ([#13991](containerd/containerd#13991)) * Deprecate task API address and version fields in runc options and move to CreateTaskRequest ([#13360](containerd/containerd#13360)) Please try out the release binaries and report any issues at https://github.com/containerd/containerd/issues. ### Contributors * Maksym Pavlenko * Sebastiaan van Stijn * Samuel Karp * Derek McGowan * Wei Fu * Akihiro Suda * Mike Brown * Paweł Gronowski * Chris Henzie * Phil Estes * Brian Goff * Austin Vazquez * ningmingxiao * Jordan Liggitt * Akhil Mohan * Eshaan Mathur * Krisztian Litkey * Chris Ayoub * Kazuyoshi Kato * Kir Kolyshkin * Sergey Kanzhelev * Ahmet Alp Balkan * Arpit Jain * Cindy Li * Damien Grisonnet * Esteban Ginez * Gao Xiang * Harsh Rawat * Laura Lorenz * Maksim An * Oleh Konko * Philip Laine * Abhishek Bhunia * Alan Grosskurth * Albin Kerouanton * Alex Lyn * Aman Raj * Amir Alavi * Amit Barve * Andrew Halaney * AprilNEA * Arjun Yogidas * Ayato Tokubi * Aysha Afrah Ziya * Ben Cressey * Bing Hongtao * Chris Crone * Craig Gumbley * Daniel De Graaf * Davanum Srinivas * Dr. Jan-Philip Gehrcke * Harshal Patel * Henry Wang * Hsiu-Chi Tsai * JP Phillips * Jing Chen * Kohei Tokunaga * LEI WANG * Martín Fernández * Mikhail Dmitrichenko * Nahum Litvin * Nikolaus Schuetz * Pablo Garcia Caceres * Paco Xu * Robert Cronin * SaloniRathi * Shambhavi Srivastava * Tianon Gravi * XlabAI * Yuanliang Zhang * ayush-panta * crawfordxx * cshung * match man * s3onghyun * 归寂 * 徐晓伟 ### Changes <details><summary>658 commits</summary> <p> * [`647fafa847`](containerd/containerd@647fafa) Prepare release notes for v2.4.0 * Prepare release notes for api/v1.12.0 ([#14170](containerd/containerd#14170)) * [`5c4ea21de3`](containerd/containerd@5c4ea21) Prepare release notes for api/v1.12.0 * Deprecations and removals for 2.4 ([#14166](containerd/containerd#14166)) * [`531b3a37b9`](containerd/containerd@531b3a3) tracing: remove deprecated tracing config options * [`ca8579a334`](containerd/containerd@ca8579a) tracing: add tests for otlp exporter and env vars * [`ee024b7c99`](containerd/containerd@ee024b7) tracing: remove deprecated otlp configs * [`f7c654fb4f`](containerd/containerd@f7c654f) cri: remove deprecated cni bin_dir * [`4f7de25abb`](containerd/containerd@4f7de25) cri: remove enable_cdi config option * [`830b48d3fd`](containerd/containerd@830b48d) cri: delay registry config removal to 2.7 * Prepare release notes for v2.4.0-rc.0 ([#14115](containerd/containerd#14115)) * [`c02620e398`](containerd/containerd@c02620e) Prepare release notes for v2.4.0-rc.0 * [`02c7c97f43`](containerd/containerd@02c7c97) Update release doc for 2.4.0 release * [`484e5aba58`](containerd/containerd@484e5ab) vendor: github.com/containerd/containerd/api v1.12.0-rc.1 * [`67174d675c`](containerd/containerd@67174d6) mailmap: add Paweł Gronowski * Update erofs snapshotter to record blob source ([#14107](containerd/containerd#14107)) * [`697a7571a4`](containerd/containerd@697a757) erofs: give a dm-verity device a name unique to its mount * [`f75817eb3b`](containerd/containerd@f75817e) erofs: record where a layer blob is * [`d92088d822`](containerd/containerd@d92088d) erofs: refuse to apply into a read-only snapshot * [`8cc0b076a6`](containerd/containerd@8cc0b07) erofs: serve layer content cache on parented Prepare * build(deps): bump the golang-x group with 4 updates ([#14150](containerd/containerd#14150)) * [`75138b3fda`](containerd/containerd@75138b3) build(deps): bump the golang-x group with 4 updates * build(deps): bump github.com/klauspost/compress from 1.19.2 to 1.20.0 ([#14153](containerd/containerd#14153)) * [`353342cae6`](containerd/containerd@353342c) build(deps): bump github.com/klauspost/compress from 1.19.2 to 1.20.0 * pkg/oci: mask thermal interrupt info ([#14090](containerd/containerd#14090)) * [`c176f185b0`](containerd/containerd@c176f185b08e14bde055d81dc509 See merge request: Harmonybrew/homebrew-core!20372
Based on #13903 — the first commit here is that PR unchanged; the two on top are an
alternative to the parts of it that were under discussion.
#13903 serves a cached layer by symlinking the cache blob into the snapshot as its
layer.erofs. That puts a path inside the snapshot directory aliasing a blob owned bythe operator and shared with every other snapshot of that layer, so every write site
needs its own guard — the differ must refuse to apply,
Commitmust refuse to convertthrough a dangling link,
Removemust notchattra file it doesn't own. A missedguard corrupts content shared across images.
erofs: refuse to apply into a read-only snapshot— the differ detected this bylooking for a symlink, which ties it to an on-disk layout and to inferring the snapshot
directory from a mount source. Refuse on the signal the unpacker already uses instead:
read-only mounts mean the snapshotter has populated the snapshot itself, so there is
nothing to apply. No path inference, and it stays correct for content the snapshotter
does not store as a plain file.
erofs: record where a layer blob is instead of linking it in— record the blob'slocation on the snapshot and mount it where it lies. Nothing in the snapshot directory
refers to content it does not own, so a stray write creates a local file, conversion
cannot reach the cache, and removal has nothing to follow; the guards stop being
load-bearing. Resolution happens in one place, which also answers whether the blob is
already populated and whether it is ours to modify, and mounts are assembled without
consulting the filesystem to find out what a layer is.
Also fixes, from the same restructure: a pruned cache entry is an error on every path
rather than a silent fallback to a writable mount on one of them; a flattened parent's
device=is resolved rather than assumed to live in the snapshot directory; and thedm-verity sidecar is read from beside the cache entry rather than copied in, so it
cannot fall out of step with the blob it pins.
The record lives in labels outside the
containerd.io/snapshot/namespace, which themetadata snapshotter filters in both directions — so no client and no image annotation
can set it, and equally a caller cannot send it back, which is why
CommitandUpdatecarry it across rather than dropping it on a caller's behalf.
No on-disk format compatibility concern: the cache is unreleased.