Commit Graph

313 Commits

Author SHA1 Message Date
Albin Kerouanton
634401d24c Don't bail out if no image verifiers available
When the local transfer plugin is instantiated, it loads verifiers
through `ic.GetByType()` which returns ErrPluginNotFound if no plugins
of the given type is available. This would happen if users explicitly
disabled the bindir plugin.

Users may wish to disable that plugin to prevent containerd from
executing arbitrary binaries on the host (e.g. when running rootless).
Currently, the only way to achieve that is to set bindir's param
`bin_dir` to the empty string but that seems more fragile than disabling
the plugin altogether.

The local transfer plugin is already checking if there are no plugins
available, and take action accordingly. Thus, not handling
`ErrPluginNotFound` seems to be an oversight.

Signed-off-by: Albin Kerouanton <albin.kerouanton@docker.com>
2026-02-13 09:31:39 +01:00
Maksym Pavlenko
f496ee86e4 Merge pull request #12789 from mxpv/replace
Fix go mod replace and sync with latest api changes
2026-01-23 20:45:45 +00:00
Fu Wei
10cf3c8bc6 Merge pull request #12782 from aadhar-agarwal/aadagarwal/fix-uuid
erofs-differ: use same UUID append style in tar index mode as tar conversion mode
2026-01-21 15:21:59 +00:00
jinda.ljd
cf7cb3c35e erofs: Move immutable file handling before storage.Remove
The layer blob immutable flag clearing logic was moved before
storage.Remove() call to ensure that immutable files can be properly
removed even if subsequent operations fail after storage.Remove().

The previous order had storage.Remove() called first, which meant if
any subsequent operations failed, there would be no opportunity to
remove the immutable flag on the layer blob files.

Signed-off-by: jinda.ljd <jinda.ljd@alibaba-inc.com>
2026-01-21 19:34:35 +08:00
ChengyuZhu6
f873e4d3c2 plugins/mount/erofs: use fsmount API to avoid PAGE_SIZE limit
The traditional mount() syscall has a PAGE_SIZE (typically 4KB) limit
for mount options. Use the new mount API (fsopen/fsconfig/fsmount/
move_mount) introduced in Linux 5.2 to bypass this limitation.

Fixed: #12662

Signed-off-by: ChengyuZhu6 <hudson@cyzhu.com>
2026-01-17 16:02:09 +08:00
Maksym Pavlenko
992597bfe9 Fix TTRPC prefix
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2026-01-15 13:06:50 -08:00
Aadhar Agarwal
52a92e83f0 erofs-differ: use same UUID append style in tar index mode as tar conversion mode
Use the same approach for appending UUID arguments in GenerateTarIndexAndAppendTar
as done in ConvertTarErofs for consistency between the two modes.

Signed-off-by: Aadhar Agarwal <aadagarwal@microsoft.com>
2026-01-14 05:29:13 +00:00
ningmingxiao
5f0f0dcaac content: ensure root directory exists before checking fs-verity support
Currently, fs-verity support detection fails on fresh containerd
installations because the content store root directory
(io.containerd.content.v1.content) doesn't exist yet. This directory
is only created when pulling images, causing checker to
always be false on new hosts.

The IsSupported() function attempts to create a temporary directory
within rootPath to test fs-verity support, but fails when rootPath
doesn't exist, returning an error that is silently ignored.

Fix this by ensuring the root directory exists before performing
the fs-verity support check in NewLabeledStore().

Signed-off-by: ningmingxiao <ning.mingxiao@zte.com.cn>
2026-01-12 09:58:11 -06:00
Akihiro Suda
9d247a7993 Merge pull request #12433 from halaney/ahalaney/erofs-idmap-latest
Add erofs idmap support
2026-01-09 06:35:49 +00:00
Maksym Pavlenko
253fbe756a Cleanup unit tests
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2026-01-06 10:52:49 -08:00
Derek McGowan
415b5a534a Merge pull request #12567 from ChengyuZhu6/erofs-mediatype
images: add EROFS layer media type
2026-01-06 06:28:28 +00:00
Maksym Pavlenko
2bddff3f21 Merge pull request #12566 from rawahars/main
Set annotations parameter in CreateSandbox request
2026-01-05 18:45:37 +00:00
Andrew Halaney
9b50650d5c snapshots/erofs: Support idmap mounts
This disables the slow_chown feature (nobody in their right mind
is going to be choosing erofs and want to slowly chown each file),
indicates that we support idmaps if the kernel supports it, and makes
sure to chown the upperdir.

This is more or less exactly how the overlay snapshotter does things,
minus the slow_chown part (which has discussions about dropping
altogether at some point anyways).

Signed-off-by: Andrew Halaney <ahalaney@netflix.com>
2026-01-02 10:05:29 -06:00
Harsh Rawat
53e696d625 set annotations parameter in CreateSandbox request
In the CreateSandbox request, which is part of the Sandbox Controller, we ignored the `Annotations` parameter which could have been set by the caller via `WithAnnotations` option.

This commit rectifies the same and adds the Annotations parameter to the request.

Signed-off-by: Harsh Rawat <harshrawat@microsoft.com>
2025-12-29 17:01:14 +05:30
Gao Xiang
9a7500a974 Add support for EROFS fsmerge feature
EROFS has supported a tiny metadata-only image to reference external
blobs since Linux 5.16. This eliminates the need to mount each EROFS
layer one by one and is also useful for VM-based containers (e.g.
nerdbox and Kata containers.)

Similar to LCOW/CimFS, `snapshots.UnpackKeyPrefix` is used to
trigger fsmerge generation (typically < 100 ms) on demand in Prepare().

In the future, we can also generate fsmeta in Commit() of the final
unpacking layer (by introducing an annotation to keep the chainID).
However, in the case of intermediate layer reuse, the Prepare() handling
will still be required.

```toml
[plugins."io.containerd.snapshotter.v1.erofs"]
  max_unmerged_layers = 1      # enable fsmerge if image layers >= 2
```

Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
2025-12-29 17:39:09 +08:00
ChengyuZhu6
36f8999b94 images: add EROFS layer media type
Signed-off-by: ChengyuZhu6 <hudson@cyzhu.com>
2025-12-23 23:19:50 +08:00
Derek McGowan
487d77ff50 Fix transfer unpack defaults on darwin
Fix the default unpack configuration on darwin to a usable
configuration.

Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-11-18 08:51:51 -08:00
Derek McGowan
497f896d65 Update default differs on darwin
Use the erofs differ by default on darwin. This could be default for all
Unix platforms but limit the default changes to fix broken cases for backports.

Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-11-18 08:51:51 -08:00
Derek McGowan
49888e001f Use default writable size in erofs snapshotter for non-Linux hosts
Non-Linux hosts are not expected to be able to directly mount erofs
snapshotters on the host system. Non-Linux hosts should use block mode
by default with a reasonably set default block size.

Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-11-18 08:51:50 -08:00
Derek McGowan
01b4c8102b Update default erofs block size on macOS during erofs diff
Use the Linux default rather than the block size from the local macOS
system. The local macOS block size is not relevant as the erofs file
will not be mounted directly on macOS.

Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-11-17 16:34:28 -08:00
Akihiro Suda
910171e90e Fix directory permissions
- Create /var/lib/containerd with 0o700 (was: 0o711).
- Create config.TempDir with 0o700 (was: 0o711).
- Create /run/containerd/io.containerd.grpc.v1.cri with 0o700 (was: 0o755).
- Create /run/containerd/io.containerd.sandbox.controller.v1.shim with 0o700 (was: 0o711).
- Leave /run/containerd and /run/containerd/io.containerd.runtime.v2.task created with 0o711,
  as required by userns-remapped containers.
  /run/containerd/io.containerd.runtime.v2.task/<NS>/<ID> is created with:
  - 0o700 for non-userns-remapped containers
  - 0o710 for userns-remapped containers with the remapped root group as the owner group.

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2025-11-04 16:04:30 +09:00
Gao Xiang
7bf5b92e6e Add Readonly setup to EROFS mount loop handler
See __fsverity_file_open():

``` c
int __fsverity_file_open(struct inode *inode, struct file *filp)
{
	if (filp->f_mode & FMODE_WRITE)
		return -EPERM;
	return ensure_verity_info(inode);
}
```

Fixes: 5b9d871fea ("Add EROFS mount handler plugin")
Closes: https://github.com/containerd/containerd/issues/12451
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
2025-11-02 08:35:52 +08:00
Wei Fu
ba524db349 snapshot: check parent's kind before commit
We should reject commit request if target parent is not committed.
Just in case we rebase active snapshot on active one.

Signed-off-by: Wei Fu <fuweid89@gmail.com>
2025-10-31 11:09:11 -04:00
Maksym Pavlenko
c07f9220cb Merge pull request #12409 from henry118/followup-12332
Remove rebase validation logic from overlay snapshotter
2025-10-27 18:42:10 +00:00
Henry Wang
d939b6af5f Remove rebase validation logic from overlay snapshotter
Signed-off-by: Henry Wang <henwang@amazon.com>
2025-10-24 21:56:59 +00:00
Derek McGowan
7b7c5c1711 Add rebase capability to erofs
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-10-24 14:06:56 -07:00
Henry Wang
0198b87fcf Implement parallel unpack
Signed-off-by: Henry Wang <henwang@amazon.com>
2025-10-24 17:54:26 +00:00
Derek McGowan
9a43ee660a Merge pull request #6488 from evankanderson/main
Default config_path if legacy registry options are not set.
2025-10-24 01:28:00 +00:00
Gao Xiang
5b9d871fea Add EROFS mount handler plugin
Commit ee8ae9d569 ("Update erofs snapshotter to use mount manager")
temporarily removed the file-backed mount feature to adapt to the new
mount manager infrastructure as a quick start.

After the mount manager was introduced, a specific mount type can be
handled with a mount handler plugin to provide a dedicated mount
process (e.g. setup loopback devices in advance or calling external
mount helpers).

This commit adds a default EROFS mount handler for the Linux hosts
to set up loop devices for mount sources and "device=" external file
blobs if necessary (i.e. when file-backed mounts are unavailable),
allowing common runtimes such as runC to work directly, e.g.
 ``` sh
 mount -t erofs /var/lib/containerd/io.containerd.snapshotter.v1.erofs/snapshots/1/layer.erofs \
  /run/containerd/io.containerd.mount-manager.v1.bolt/t/346/1
 ```
 will be handled as
 ``` sh
 mount -t erofs /dev/loop1 /run/containerd/io.containerd.mount-manager.v1.bolt/t/346/1
 ```
and
 ``` sh
 mount -t erofs /var/lib/containerd/io.containerd.snapshotter.v1.erofs/snapshots/7/fsmeta.erofs \
   -odevice=/var/lib/containerd/io.containerd.snapshotter.v1.erofs/snapshots/1/layer.erofs,\
     device=/var/lib/containerd/io.containerd.snapshotter.v1.erofs/snapshots/2/layer.erofs,\
     ...
     device=/var/lib/containerd/io.containerd.snapshotter.v1.erofs/snapshots/7/layer.erofs
   /run/containerd/io.containerd.mount-manager.v1.bolt/t/335/1
 ```
 will be handled as
 ``` sh
 mount -t erofs /dev/loop1 -odevice=/dev/loop2,device=/dev/loop3,... \
   /run/containerd/io.containerd.mount-manager.v1.bolt/t/335/1
 ```
if file-backed mounts are unavailable.

For other host platforms (e.g. Darwin hosts) or specific runtimes
that require EROFS raw mounts instead of parsed mounts, this plugin
can be explicitly masked off by users.

Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
2025-10-22 22:57:42 +08:00
Gao Xiang
8a6e6263f8 Support arbitary mkfs size (not only in MiB)
Rename `default_size_mb` to `default_size` so that it's similar to
Docker's `--storage-opt size=30G` flag.  For example,

``` toml
[plugins."io.containerd.snapshotter.v1.erofs"]
  default_size = "5GB"
```

Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
2025-10-21 15:35:05 +08:00
Fu Wei
e95415b723 Merge pull request #12333 from dmcgowan/erofs-block-files
Update erofs snapshotter to use mount manager
2025-10-20 02:43:50 +00:00
Evan Anderson
5386802f8a Default config_path if legacy registry options are not set.
Signed-off-by: Evan Anderson <evan.k.anderson@gmail.com>
2025-10-16 17:51:44 -07:00
Derek McGowan
2f75989e2a Update erofs to use mount transformers
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-10-14 22:53:43 -07:00
Derek McGowan
be9f183f45 Add mount transformers to mount manager
Extend the mount manager to support more transformers than format. The
transformers allow altering the mount before it is passed to the mount
handlers. These could be one-time actions which are needed to perform
the mount.

Adds mkdir and mkfs actions which can be used to prepare the arguments
for a mount. The actions can be limited to actions within the target
mount directory or plugin directories.

Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-10-14 16:35:53 -07:00
Derek McGowan
1adaf27c1e Update erofs to compile on Darwin
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-10-13 19:33:44 -07:00
Derek McGowan
ee8ae9d569 Update erofs snapshotter to use mount manager
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-10-13 19:33:44 -07:00
ningmingxiao
ed2e81a78e bugfix:sync parent dir to ensure blob entry is reliably stored
Signed-off-by: ningmingxiao <ning.mingxiao@zte.com.cn>
2025-10-11 20:22:14 +08:00
Aadhar Agarwal
773bfa0eae Use tartest to simplify generating a tar
Signed-off-by: Aadhar Agarwal <aadagarwal@microsoft.com>
2025-10-08 21:35:19 +00:00
Aadhar Agarwal
6a3b10fe76 Add a test for the erofs differ using tar index mode
Signed-off-by: Aadhar Agarwal <aadagarwal@microsoft.com>
2025-10-08 21:35:16 +00:00
Derek McGowan
e2157e37df Merge pull request #12345 from dmcgowan/fix-sandbox-controller-dependencies
Fix sandbox controller dependencies
2025-10-03 20:46:33 +00:00
Derek McGowan
843aee8d3f Merge pull request #12342 from dmcgowan/fix-sandbox-client
Fixes for sandbox client
2025-10-03 20:39:45 +00:00
Fu Wei
61ddcd5372 Merge pull request #12063 from dmcgowan/mount-manager
Add mount manager
2025-10-03 14:01:38 +00:00
Derek McGowan
c69f443ba8 Update sandbox controllers service implicit dependency
The sandbox controller should only error out if it cannot find any
sandbox controllers. If it requires the pod sandbox controller to be
initialized, that creates an implicit dependency on all CRI plugins
being initialized. The sandbox controller API can be used without CRI
and therefore should not have this dependency.

Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-10-02 16:49:39 -07:00
Derek McGowan
637429a252 Update logging for sandbox controller service
Add more details and differentiate log line from sandbox store calls

Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-10-01 17:14:16 -07:00
Derek McGowan
aba772012a Add debug logs to mount service calls
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-09-29 17:08:32 -07:00
Derek McGowan
d23e635a5c Fix mount manager plugin when no handlers provided
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-09-29 17:08:32 -07:00
Derek McGowan
8db3010865 Add mounts api service
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-09-29 17:08:31 -07:00
Rehan Khan
33e6b79fc0 Fix device mapper suspend/resume flakyness
Signed-off-by: Rehan Khan <Rehan.Khan7@ibm.com>
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
2025-09-24 01:37:36 +08:00
Derek McGowan
ed03f3a710 Add mount manager plugin and types
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-09-18 17:08:43 -07:00
Derek McGowan
37cec68004 Move transaction context to boltutil
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-09-18 17:08:42 -07:00