Commit Graph

19443 Commits

Author SHA1 Message Date
Alex Lyn
207f019bb5 kata-agent: Add dm-verity device cleanup for GPT-partitioned layers
Add per-container verity_devices tracking in Sandbox and wire the
teardown path: destroy_partition_dmverity_device removes the
device-mapper target via deferred-remove ioctl and deletes the mknod
node, cleanup_dmverity_devices iterates all devices in reverse order.

Wire into remove_container_resources (rpc.rs) so verity devices are
torn down after unmount, and record verity device paths in
add_storages (storage/mod.rs) for tracking.

Signed-off-by: Alex Lyn <alex.lyn@antgroup.com>
2026-06-23 09:51:40 +08:00
Alex Lyn
63840fb006 kata-agent: Add dm-verity device creation for GPT-partitioned layers
GPT-partitioned EROFS layers can carry dm-verity hashes appended after
the filesystem data within the same partition. The host runtime passes
the root hash and parameters as X-kata.dmverity.* storage options; the
agent must set up the kernel dm-verity target before mounting so that
every read is integrity-checked against the Merkle tree.

Implement dm-verity device creation: option parsing from storage
options, device name generation, and create helper via devicemapper
ioctls with hash_start_block calculation (accounting for v1 superblock
presence).

Signed-off-by: Alex Lyn <alex.lyn@antgroup.com>
2026-06-23 09:51:40 +08:00
Alex Lyn
945c50c96f kata-agent: Add no-udev DmOptions builders and mknod device node helpers
The kata guest VM runs without udev, so device-mapper nodes under
/dev/mapper are never created automatically. Add the foundational
helpers that subsequent dm-verity integration will rely on:

It focus on the following key points:
(1) DmOptions builders that disable all udev synchronization flags,
  with read-only and deferred-remove variants.
(2) mknod-based device node creation/removal under /dev/mapper, since
  devtmpfs nodes are not auto-created without udev.

Also add the devicemapper crate dependency (default-features = false).

But note that the commit depends on device mapper with no-udev support
with the PR:https://github.com/stratis-storage/devicemapper-rs/pull/1036

Signed-off-by: Alex Lyn <alex.lyn@antgroup.com>
2026-06-23 09:51:38 +08:00
Alex Lyn
656d445bb3 runtime-rs: Add dm-verity annotation extraction to GPT+VMDK integration
Extract dm-verity metadata from containerd mount annotations and pass
them through to kata-agent as X-kata.dmverity.* storage options. This
enables the agent to create dm-verity devices for integrity-verified
EROFS partitions.

Signed-off-by: Alex Lyn <alex.lyn@antgroup.com>
2026-06-23 09:51:04 +08:00
Alex Lyn
cafa64acf4 runtime-rs: Add dm-verity utility functions to gpt_disk module
When containerd creates dm-verity-protected EROFS layers, it stores
the root hash and parameters as OCI annotations — but the format
does not directly map to the kernel dm-verity table that the guest
agent needs to construct.

Bridge this gap with functions that parse containerd's dm-verity
annotation JSON, detect whether a v1 superblock is embedded at the
hash offset (to extract the salt automatically rather than relying
on containerd's hardcoded default), and produce the X-kata.dmverity.*
storage options the agent expects.

This keeps all dm-verity metadata translation on the host side, so
the agent can consume a flat list of options without understanding
the containerd annotation schema.

Signed-off-by: Alex Lyn <alex.lyn@antgroup.com>
2026-06-23 09:51:04 +08:00
Alex Lyn
4f54ccefee kata-types: Extend DmVerityInfo with salt, hash_type, no_superblock fields
Add fields to DmVerityInfo needed for dm-verity device creation:
(1) salt: Optional salt value for the hash computation
(2) hash_type: dm-verity version
(3) no_superblock: whether to skip the superblock at hash offset

Uses serde defaults for backward compatibility with existing serialized
data that lacks these fields.

Signed-off-by: Alex Lyn <alex.lyn@antgroup.com>
2026-06-23 09:51:04 +08:00
Fabiano Fidêncio
bbe714ae03 Merge pull request #13227 from fidencio/topic/rfc-composable-vm-images-update
docs: detail composable image runtime contracts in proposal
2026-06-22 21:07:04 +02:00
Fabiano Fidêncio
84db260d9a docs: detail composable image runtime contracts in proposal
Update the composable-vm-images proposal with the design decisions we only
arrived at after experimenting with the implementation:

* Replace the hardcoded agent path-resolution table with the data-driven
  components.toml manifest (process levels, args/optional_args, env,
  wait_socket, ${...} substitution, and select/variants), keeping the agent
  generic.
* Document the attester-variant contract: NVRC exports KATA_ATTESTER_VARIANT
  and the manifest selects the stock vs NVIDIA attestation-agent.
* Document the runtime dependency requirements found during bring-up: the
  nvidia attester's LD_LIBRARY_PATH (libnvat closure in the coco addon +
  NVML in the gpu addon) and the NVML-init failure mode, plus CDH
  secure_mount tooling placement -- plain storage (mke2fs/mkfs.ext4/dd) in
  the base vs encrypted storage (cryptsetup) in the coco addon, the CDH
  PATH, and the base/addon ABI lockstep.
* Reflect the storage tooling and bundled libraries in the base/coco-addon
  build sections, and mark the GPU addon as implemented.

Signed-off-by: Fabiano Fidêncio <ffidencio@nvidia.com>
Assisted-by: Cursor <cursoragent@cursor.com>
2026-06-22 20:04:25 +02:00
Fabiano Fidêncio
9761ea2235 Merge pull request #13164 from manuelh-dev/mahuber/remove-resource-requests
tests: use limits for Kata workload resources
2026-06-22 20:01:33 +02:00
Fabiano Fidêncio
d406a747a9 Merge pull request #13258 from fidencio/topic/fix-publish-payload-after-merge
ci: do not publish a kata-monitor job-dispatcher manifest
2026-06-22 18:35:41 +02:00
Fabiano Fidêncio
a3f160bd40 ci: do not publish a kata-monitor job-dispatcher manifest
The kata-monitor image has no job-dispatcher sidecar, so opt out of the
kata-deploy-specific dispatcher manifest derivation in the
payload-after-push workflow by setting
KATA_DEPLOY_PUBLISH_JOB_DISPATCHER=false, mirroring the same fix already
applied to the release workflows.

Signed-off-by: Fabiano Fidêncio <ffidencio@nvidia.com>
2026-06-22 13:49:57 +02:00
Fabiano Fidêncio
f1ebefcdfb Merge pull request #13222 from fidencio/topic/nvidia-switch-to-kata-deploy-jobs
kata-deploy: nvidia: Default to the Job-based deployment mode
2026-06-22 12:55:10 +02:00
Steve Horsman
a87d71763e Merge pull request #13255 from kata-containers/dependabot/go_modules/src/runtime/github.com/containerd/containerd-1.7.33
build(deps): bump github.com/containerd/containerd from 1.7.32 to 1.7.33 in /src/runtime
2026-06-22 11:17:54 +01:00
Steve Horsman
20bcff185f Merge pull request #13254 from kata-containers/dependabot/go_modules/src/runtime/go.mongodb.org/mongo-driver-1.17.7
build(deps): bump go.mongodb.org/mongo-driver from 1.14.0 to 1.17.7 in /src/runtime
2026-06-22 11:17:29 +01:00
Fabiano Fidêncio
f9682356ce Merge pull request #13216 from Apokleos/hotunplug-blk
runtime-rs: Add support for hot-unplugging block devices
2026-06-22 12:14:30 +02:00
Fabiano Fidêncio
337b600268 Merge pull request #13256 from fidencio/release/3.32.0
release: Bump version to 3.32.0
3.32.0
2026-06-22 10:33:25 +02:00
Alex Lyn
9550a323ac Merge pull request #13245 from kata-containers/unify-nix-version
Unify nix version
2026-06-22 15:25:10 +08:00
Alex Lyn
7aaa4e63d1 Merge pull request #13241 from PiotrProkop/exit-code
agent: report 128+signal as exit code for signal-terminated processes
2026-06-22 09:13:24 +08:00
Fabiano Fidêncio
dc70b93573 release: Bump version to 3.32.0
Bump VERSION and helm-charts versions.

Signed-off-by: Fabiano Fidêncio <ffidencio@nvidia.com>
2026-06-22 01:15:24 +02:00
PiotrProkop
c2d737c9d7 agent: report 128+signal as exit code for signal-terminated processes
When a container process is terminated by a signal, the agent's SIGCHLD
reaper stored the raw signal number as the process exit code. As a result
a process killed by SIGKILL(9) reported exit code 9 instead of the
conventional 137 (128+9).

Apply the standard shell convention of 128+signal_number so that
signal-terminated processes report the expected exit codes, e.g.
SIGKILL(9) -> 137, SIGTERM(15) -> 143, SIGINT(2) -> 130. This mimics
runc, which encodes wait-status exit codes the same way:
https://github.com/opencontainers/runc/blob/v1.4.3/libcontainer/utils/utils.go#L19

Both runc and this new Kata behaviour follow the conventional exit code
semantics documented at https://tldp.org/LDP/abs/html/exitcodes.html.

The conversion is factored into a small helper and covered by a unit
test. The runtime and shim already pass the exit code through unchanged,
so no further changes are needed for the corrected value to surface.

Fixes: signal-terminated containers reporting raw signal numbers

Signed-off-by: PiotrProkop <pprokop@nvidia.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-21 16:34:17 +02:00
dependabot[bot]
9c6cccb483 build(deps): bump github.com/containerd/containerd in /src/runtime
Bumps [github.com/containerd/containerd](https://github.com/containerd/containerd) from 1.7.32 to 1.7.33.
- [Release notes](https://github.com/containerd/containerd/releases)
- [Changelog](https://github.com/containerd/containerd/blob/main/RELEASES.md)
- [Commits](https://github.com/containerd/containerd/compare/v1.7.32...v1.7.33)

---
updated-dependencies:
- dependency-name: github.com/containerd/containerd
  dependency-version: 1.7.33
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-06-21 14:32:17 +00:00
Fabiano Fidêncio
374a867774 Merge pull request #13196 from microsoft/cameronbaird/upstream/runtime-go-clh-templating
runtime: Enable VM Templating Support for CLH
2026-06-21 16:31:19 +02:00
Alex Lyn
0a63aebea9 runtime-rs: Implement remove_device for block device hot removal
Replace the "Not yet implemented" stub in QemuInner::remove_device()
with a working implementation that calls hotunplug_device() to perform
the QMP-level device removal, then cleans up the internal devices list
via retain() to remove stale coldplug entries.

Signed-off-by: Alex Lyn <alex.lyn@antgroup.com>
2026-06-20 22:08:57 +08:00
Alex Lyn
d4212bcb74 runtime-rs: Add hotunplug_device dispatcher for device type routing
Introduce hotunplug_device() as the device-type dispatcher that routes
hot removal requests to the appropriate QMP method. Currently supports
Block and BlockModern device types, which are forwarded to
Qmp::hotunplug_block_device(). All other device types return an
explicit "unsupported" error.

Signed-off-by: Alex Lyn <alex.lyn@antgroup.com>
2026-06-20 22:08:57 +08:00
Alex Lyn
281b6aa61a runtime-rs: Add hotunplug_block_device for block device hot removal
Implement QMP-level block device hot-unplug by issuing device_del to
remove the frontend device and blockdev_del to remove the backend
blockdev node. For virtio-blk-ccw on s390x, the CCW subchannel slot
is also released.

Since QMP device_del is asynchronous and only initiates the removal
request, introduce wait_for_device_deleted() to poll for the
DEVICE_DELETED event before tearing down the backend. This prevents
blockdev_del from failing with "Node is still in use".

If blockdev_del fails, the error is logged but CCW cleanup still
proceeds before the error is propagated, ensuring consistent
subchannel state.

Signed-off-by: Alex Lyn <alex.lyn@antgroup.com>
2026-06-20 22:08:57 +08:00
Alex Lyn
431720025c runtime-rs: Enhance hotplug_block_device error handling and rollback
Improve the reliability of block device hotplug by ensuring that
blockdev-add nodes are properly cleaned up when subsequent device_add
operations fail.

To address this, A new method of device_add_with_rollback is introduced
to do device_add and do properly cleaned up when it fails.

Signed-off-by: Alex Lyn <alex.lyn@antgroup.com>
2026-06-20 22:08:57 +08:00
dependabot[bot]
399c863cd2 build(deps): bump go.mongodb.org/mongo-driver in /src/runtime
Bumps [go.mongodb.org/mongo-driver](https://github.com/mongodb/mongo-go-driver) from 1.14.0 to 1.17.7.
- [Release notes](https://github.com/mongodb/mongo-go-driver/releases)
- [Commits](https://github.com/mongodb/mongo-go-driver/compare/v1.14.0...v1.17.7)

---
updated-dependencies:
- dependency-name: go.mongodb.org/mongo-driver
  dependency-version: 1.17.7
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-06-20 10:22:56 +00:00
Cameron Baird
730307f32c factory: Default to normal sandbox boot path when factory init not done
The behavior we had before was that, for a starting k8s pod,
it sees enable_template=true and therefore:

1. Tries NewFactory with fetchOnly=true
2. When that fails (because template.Fetch fails to find the artifacts,
	we retry with fetchOnly=false. This creates a direct factory
	which creates the template from scratch
	(hence we pay a full pod sandbox boot time here)
	and then restores from that. Hence the boot times
	are strictly worse on this path.

Now, even when enable_template=true, we don't try to force a direct factory.
Instead we just revert to the standard sandbox boot path.

Signed-off-by: Cameron Baird <cameronbaird@microsoft.com>
2026-06-19 18:00:02 +00:00
Cameron Baird
65a5f272f8 ci: Introduce tests for VM template factory
Add k8s-vm-templating-test.bats which exercises pod create
with the factory initialized on the target node.

Signed-off-by: Cameron Baird <cameronbaird@microsoft.com>
2026-06-19 18:00:02 +00:00
Cameron Baird
c0f9744225 runtime: Implement support for VM Template factory in clh
Add support for VM Template factory on the clh path.

In order to support snapshot/restore-based VM templating,
the following changes were needed:
1. For clh.go, implement SaveVM, PauseVM, restoreVM, ResumeVM
2. Remove initrd config check for VM Templating path. The
        root disk image (when using image mode) is created in memory
        and therefore captured in the VM snapshot.
3. Truncate the memory file to the size of the VM at factory VM
        create time. This allows CLH to use the memory file
        as the backing for the template VM memory, allowing O(1)
        snapshot times.
4. CLH uses memory zones as backing for its memory on the template paths
5. Update StartVM in CLH to use the restore path when template is
        configured and available

Signed-off-by: Cameron Baird <cameronbaird@microsoft.com>
2026-06-19 18:00:02 +00:00
Manuel Huber
aafd16515c tests: use limits for Kata workload manifests
Kata sizes VM CPU and memory from OCI limits, not Kubernetes resource
requests. Requests are consumed by the Kubernetes control plane, but
they do not drive Kata VM or sandbox sizing today.

Convert the straightforward Kata workload manifests and kata-deploy
examples from resource requests to limits so the declared resources
match the values Kata uses for VM provisioning. Keep requests where the
fixture intentionally validates Kubernetes request/limit behavior.

Update fixture expectations affected by the conversion. The LimitRange
fixture is limit-only at 500m.

Raise the policy deployment limits to 500m and 800Mi. These tests boot
CoCo/runtime-rs sandboxes with policy/initdata, and the former
100m/100Mi values became real runtime limits after the conversion,
which is too constrained for the CI environments.

Leave PVC storage requests, explicit request/limit validation fixtures,
the env resourceFieldRef request, and non-Kata workload examples
unchanged where requests are handled outside the Kata shim resource
sizing path.

If Kata later grows request-aware sandbox sizing, for example through
Sandbox API based resource plumbing, these requests can be reintroduced
where they carry the intended semantics.

Signed-off-by: Manuel Huber <manuelh@nvidia.com>
Assisted-by: OpenAI Codex <codex@openai.com>
2026-06-19 09:38:15 -07:00
stevenhorsman
d09d1959c2 libs: Update mem-agent to use nix workspace version
Now that the workspace version has been updated,
switch the mem-agent to pick up the new workspace version

Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2026-06-19 03:49:16 -07:00
stevenhorsman
531877f28f deps: Upgrade nix crate from 0.26.4 to 0.31.3
Upgrade the nix crate across the workspace to version 0.30.1 to address
security vulnerabilities and adopt safer file descriptor handling patterns.

### Breaking Changes in nix 0.28.0

1. **File Descriptor Type Changes**
   - Functions now return `OwnedFd` instead of `RawFd` (i32)
   - Functions requiring file descriptors now expect types implementing `AsFd` trait
   - This provides RAII-based automatic cleanup and prevents fd leaks

2. **API Signature Changes**
   - `pipe()`, `pipe2()`, `openpty()` now return `OwnedFd` tuples
   - `socket()` returns `OwnedFd` instead of `RawFd`
   - `open()`, `memfd_create()` return `OwnedFd`
   - `setns()`, `write()`, `fcntl()` require `AsFd` trait
   - `madvise()` requires `NonNull<c_void>` instead of raw pointer
   - `bind()`, `listen()`, `connect()` require `AsFd` and `Backlog` type

3. **Module Feature Flags**
   - Modules now require explicit feature flags (mman, reboot, etc.)

### Additional Breaking Changes in nix 0.30.1

1. **symlinkat() API Change**
   - `dirfd` parameter now requires `AsFd` trait instead of `Option<RawFd>`
   - Use `BorrowedFd::borrow_raw(libc::AT_FDCWD)` for current directory

2. **Type Alias Deprecation**
   - `MemFdCreateFlag` renamed to `MFdFlags` for consistency

### Changes Made

**Workspace Configuration (Cargo.toml)**
- Updated nix to 0.30.1 with features: fs, mount, sched, process, ioctl,
  signal, socket, feature, user, hostname, term, event, mman, reboot

**File Descriptor Handling Patterns**
- Use `BorrowedFd::borrow_raw(raw_fd)` to wrap RawFd for AsFd requirements
- Use `.as_fd().as_raw_fd()` to extract raw fd without ownership transfer
- Use `.into_raw_fd()` only when ownership transfer is needed
- Use `NonNull::new().unwrap()` for madvise pointer conversion

**Deprecated API Replacements**
- `eventfd()` → `EventFd::from_value_and_flags()`
- `Errno::from_i32()` → `Errno::from_raw()`
- `listen(fd, backlog)` → `listen(&fd, Backlog::new(backlog).unwrap())`
- `MemFdCreateFlag` → `MFdFlags`

Generated by: IBM Bob
Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2026-06-19 03:49:16 -07:00
stevenhorsman
ac508b093d runtime-rs: Use workspace nix version
See if we can sync to use the workspace version for easier
dependency management

Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2026-06-19 03:49:16 -07:00
stevenhorsman
2b8b09469d dragonball: Use workspace nix version
See if we can sync to use the workspace version for easier
dependency management

Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2026-06-19 03:49:16 -07:00
stevenhorsman
b37b81bb75 lib: Use workspace nix version
We have a note in the workspace Cargo.toml that the version
there needs to be in sync with the libs versions, so just update
them to use the workspace version rather than manually managing this.

Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2026-06-19 03:49:16 -07:00
Steve Horsman
ec55a74969 Merge pull request #11485 from kata-containers/zvonkok-patch-1
Create SECURITY.md
2026-06-19 09:19:26 +01:00
Hyounggyu Choi
103b0b2cbc Merge pull request #13078 from SantoshMadhukar-K/improved-test-coverage
test: Improve test coverage for device handlers
2026-06-19 03:52:14 +02:00
SantoshMadhukar-K
736e07d18e test: Improve test coverage for device handlers
Add comprehensive test coverage for the device handler modules under
src/agent/src/device, including matcher behavior, edge cases, and
shared helper coverage across block, network, nvdimm, scsi, and vfio
device paths.

Assisted-by: IBM Bob

Signed-off-by: SantoshMadhukar-K <SantoshMadhukar.Khandyana@ibm.com>
2026-06-18 07:18:36 -07:00
stevenhorsman
4bbbcb813e doc: Create SECURITY.md
Explicit SECURITY.md that reflects Kata’s rolling-release model
(monthly cadence, no long-term branches) and sets clear expectations
for reporters and downstream users.
With the SECURITY.md in place we need also the SECURITY_CONTACTS

- Add alternative reporting method (email) for non-GitHub users
- Add section for downstream distributions and vendors with early notification details
- Clarify that timelines are independent objectives, not sequential steps
- Reorder disclosure process to emphasize patch releases are exceptions
- Update git tag command in version table (remove unnecessary pipe)
- Expand FAQ with downstream distribution and non-GitHub reporter questions
- Update timestamp to reflect current changes (2026-04-01)
- Update SECURITY_CONTACTS with email contact and downstream notification info
- Clarify CVE assignment process through GitHub

Signed-off-by: Anastassios Nanos <ananos@nubificus.co.uk>
Signed-off-by: Zvonko Kaiser <zkaiser@nvidia.com>
Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2026-06-18 14:23:52 +01:00
Steve Horsman
49ce886f20 Merge pull request #13242 from charludo/fix/runtime-rs-safe-path
runtime-rs: change `safe-path` dependency from crates.io to workspace
2026-06-18 11:39:19 +01:00
Charlotte Hartmann Paludo
b4be5fdcca runtime-rs: change safe-path dependency from crates.io to workspace
`safe-path` is resolved from the local workspace in all other workspace
member crates. This commit changes the dependency to a local one for
runtime-rs as well.

Signed-off-by: Charlotte Hartmann Paludo <git@charlotteharludo.com>
Co-authored-by: Markus Rudy <mr@edgeless.systems>
2026-06-18 06:32:06 +02:00
Steve Horsman
66e938e02d Merge pull request #13244 from BbolroC/use-ibm-actionspz-runners-for-publishing-jobs
GHA: Use IBM ActionsPZ runners for publish jobs on s390x
2026-06-17 15:45:20 +01:00
Hyounggyu Choi
308eb34af6 GHA: Use IBM ActionsPZ runners for publish jobs on s390x
Let's use the ActionsPZ runners for the following jobs:
- publish-kata-deploy-image-s390x
- publish-kata-monitor-image-s390x

to improve CI experiences.

Signed-off-by: Hyounggyu Choi <Hyounggyu.Choi@ibm.com>
2026-06-17 15:34:39 +02:00
Alex Lyn
47ac08b419 Merge pull request #13239 from Apokleos/remove-9p
runtime-rs: Remove unused msize_9p totally from configurations
2026-06-17 20:17:52 +08:00
Greg Kurz
f0f8233759 Merge pull request #13237 from gkurz/osbuilder-version
osbuilder: Simplify version fetching
2026-06-17 13:56:13 +02:00
Greg Kurz
c3d98fe323 osbuilder: Simplify version fetching
`tools/osbuilder/VERSION` points to the root `VERSION` file,
just like the code does. Use that file.

Signed-off-by: Greg Kurz <groug@kaod.org>
2026-06-17 10:08:23 +02:00
Alex Lyn
854eef0312 runtime-rs: Remove unused msize_9p totally from configurations
As virtio-9p is deprecated already, and its msize_9p should be
deprecated too. This commit aims to remove the unused msize_9p.

Signed-off-by: Alex Lyn <alex.lyn@antgroup.com>
2026-06-17 14:53:48 +08:00
Fabiano Fidêncio
0ddb2ee1f1 Merge pull request #13160 from LandonTClipp/kata_visible_devices
feat(agent): translate KATA_VISIBLE_DEVICES into CDI GPU requests
2026-06-16 19:10:35 +02:00
Fabiano Fidêncio
3ca5742338 Merge pull request #13129 from pmores/fix-default_memory_annontation
runtime-rs: fix default_memory annonation processing
2026-06-16 18:11:19 +02:00