Commit Graph

5462 Commits

Author SHA1 Message Date
Xynnn007
4da31bf2f9 agent: deliver initdata toml to attestation agent
Now AA supports to receive initdata toml plaintext and deliver it in the
attestation. This patch creates a file under
'/run/confidential-containers/initdata'
to store the initdata toml and give it to AA process.

When we have a separate component to handle initdata, we will move the
logic to that component.

Signed-off-by: Xynnn007 <xynnn@linux.alibaba.com>
2025-07-15 17:10:56 +08:00
Steve Horsman
d219fc20e1 Merge pull request #11555 from stevenhorsman/rust-advisory-fixes-pre-3.19.0
Rust advisory fixes pre 3.19.0
2025-07-15 09:11:33 +01:00
teawater
028f25ac84 mem-agent: Update to kata-20250627
Update to https://github.com/teawater/mem-agent/tree/kata-20250627.

The commit list:
3854b3a Update nix version from 0.23.2 to 0.30.1
d9a4ced Update tokio version from 1.33 to 1.45.1
9115c4d run_eviction_single_config: Simplify check evicted pages after
	eviction
68b48d2 get_swappiness: Use a rounding method to obtain the swappiness
	value
14c4508 run_eviction_single_config: Add max_seq and min_seq check with
	each info
8a3a642 run_eviction_single_config: Move infov update to main loop
b6d30cf memcg.rs: run_aging_single_config: Fix error of last_inc_time
	check
54fce7e memcg.rs: Update anon eviction code
41c31bf cgroup.rs: Fix build issue with musl
0d6aa77 Remove lazy_static from dependencies
a66711d memcg.rs: update_and_add: Fix memcg not work after set memcg
	issue
cb932b1 Add logs and change some level of some logs
93c7ad8 Add per-cgroup and per-numa config support
092a75b Remove all Cargo.lock to support different versions of rust
540bf04 Update mem-agent-srv, mem-agent-ctl and mem-agent-lib to
	v0.2.0
81f39b2 compact.rs: Change default value of compact_sec_max to 300
c455d47 compact.rs: Fix psi_path error with cgroup v2 issue
6016e86 misc.rs: Fix log error
ded90e9 Set mem-agent-srv and mem-agent-ctl as bin

Fixes: #11478

Signed-off-by: teawater <zhuhui@kylinos.cn>
2025-07-15 08:57:41 +08:00
Zvonko Kaiser
90bc749a19 gpu: Add proper TDX config path
This was missed during the GPU TDX experimental enablement

Signed-off-by: Zvonko Kaiser <zkaiser@nvidia.com>
2025-07-14 23:26:28 +00:00
stevenhorsman
18597588c0 agent: Bump cdi version
Bump cdi version to the pick up fixes to:
- RUSTSEC-2025-0024
- RUSTSEC-2025-0023
- RUSTSEC-2024-0370

Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2025-07-14 16:54:30 +01:00
stevenhorsman
661d88b11f versions: Bump oci-spec
Try bumping oci-spec to 0.8.1 as it included fixes for vulnerabilities
including RUSTSEC-2024-0370

Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2025-07-14 16:54:30 +01:00
Fabiano Fidêncio
579d373623 Merge pull request #11521 from stevenhorsman/idna-1.0.4-bump
versions: Bump idna crate to >= 1.0.3
2025-07-14 17:39:30 +02:00
Fabiano Fidêncio
f5decea13e Merge pull request #11550 from stevenhorsman/runtime-rs-bump-chrono-0.4.41
runtime-rs | trace-forwarder: Bump chrono crate version
2025-07-14 16:45:58 +02:00
alex.lyn
9cc14e4908 runtime-rs: Update block device driver docs within configuration
The previous description for the `block_device_driver` was inaccurate or
outdated. This commit updates the documentation to provide a more
precise explanation of its function.

Fixes #11488

Signed-off-by: alex.lyn <alex.lyn@antgroup.com>
2025-07-11 17:40:58 +02:00
alex.lyn
92160c82ff runtime-rs: Change block device driver defualt with virtio-blk-*
When we run a kata pod with runtime-rs/qemu and with a default
configuration toml, it will fail with error "unsupported driver type
virtio-scsi".
As virtio-scsi within runtime-rs is not so popular, we set default block
device driver with `virtio-blk-*`.

Fixes #11488

Signed-off-by: alex.lyn <alex.lyn@antgroup.com>
2025-07-11 17:40:58 +02:00
Ankita Pareek
5f08cc75b3 agent: update the processes hashmap to use exec_id as primary key
This patch changes the container process HashMap to use exec_id as the primary
key instead of PID, preventing exec_id collisions that could be exploited in
Confidential Computing scenarios where the host is less trusted than the guest.

Key changes:
- Changed `processes: HashMap<pid_t, Process>` to `HashMap<String, Process>`
- Added exec_id collision detection in `start()` method
- Updated process lookup operations to use exec_id directly
- Simplified `get_process()` with direct HashMap access

This prevents multiple exec operations from reusing the same exec_id, which
could be problematic in CoCo use cases where process isolation and unique
identification are critical for security.

Signed-off-by: Ankita Pareek <ankitapareek@microsoft.com>
2025-07-11 10:10:23 +00:00
Alex Lyn
87e41e2a09 Merge pull request #11549 from stevenhorsman/bump-remove_dir_all
runtime-rs: Switch tempdir to tempfile
2025-07-11 13:46:12 +08:00
Alex Lyn
f22272b8f7 Merge pull request #11540 from Apokleos/coldplug-vfio-clh
runtime-rs: Add vfio support with coldplug for cloud-hypervisor
2025-07-11 10:33:59 +08:00
stevenhorsman
c740896b1c trace-forwarder: Bump chrono crate version
Bump chrono version to drop time@0.1.43 and remediate
vulnerability CVE-2020-26235

Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2025-07-10 14:55:20 +01:00
stevenhorsman
3916507553 runtime-rs: Bump chrono crate version
Bump chrono version to drop time@0.1.45 and remediate
vulnerability CVE-2020-26235

Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2025-07-10 13:47:05 +01:00
stevenhorsman
c5ceae887b runtime-rs: Switch tempdir to tempfile
tempdir hasn't been updated for seven years and pulls in
remove_dir_all@0.5.3 which has security advisory
GHSA-mc8h-8q98-g5hr, so replace this with using tempfile,
which the crate got merged into and we use elsewhere in the
project

Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2025-07-10 12:16:35 +01:00
Ruoqing He
4039506740 libs: Ignore Cargo.lock in libs workspace
Ignore Cargo.lock in `libs` to prevent developers from accidentally
track lock files in `libs` workspace.

Signed-off-by: Ruoqing He <heruoqing@iscas.ac.cn>
2025-07-10 09:31:45 +00:00
alex.lyn
3fbe493edc runtime-rs: Convert host devices within VmConfig for cloud-hypervisor
This PR adds support for adding a network device before starting the
cloud-hypervisor VM.
This commit will get the host devices from NamedHypervisorConfig and
assign it to VmConfig's devices which is for vfio devices when clh
starts launching.
And with this, it successfully finish the vfio devices conversion from
a generic Hypervisor config to a clh specific VmConfig.

Signed-off-by: alex.lyn <alex.lyn@antgroup.com>
Signed-off-by: Fupan Li <fupan.lfp@antgroup.com>
2025-07-10 16:33:43 +08:00
alex.lyn
0b5b8f549d runtime-rs: Introduce a field host_devices within NamedHypervisorConfig
This commit introduce `host_devices` to help convert vfio devices from
a generic hypervisor config to a cloud-hypervisor specific VmConfig.

Signed-off-by: alex.lyn <alex.lyn@antgroup.com>
Signed-off-by: Fupan Li <fupan.lfp@antgroup.com>
2025-07-10 16:33:41 +08:00
alex.lyn
d37183d754 runtime-rs: Add vfio support with coldplug for cloud-hypervisor
This PR adds support for adding a vfio device before starting the
cloud-hypervisor VM (or cold-plug vfio device).

This commit changes "pending_devices" for clh implementation via adding
DeviceType::Vfio() into pending_devices. And it will get shared host devices
after correctly handling vfio devices (Specially for primary device).

Signed-off-by: alex.lyn <alex.lyn@antgroup.com>
Signed-off-by: Fupan Li <fupan.lfp@antgroup.com>
2025-07-10 16:32:21 +08:00
Ruoqing He
ffa3a5a15e libs: Remove Cargo.lock
crates in `libs` workspace do not ship binaries, they are just libraries
for other workspace to reference, the `Cargo.lock` file hence would not
take effect. Removing Cargo.lock for `libs` workspace.

Signed-off-by: Ruoqing He <heruoqing@iscas.ac.cn>
2025-07-10 03:14:55 +00:00
Hyounggyu Choi
09297b7955 Merge pull request #11537 from BbolroC/set-sharedfs-to-none-for-ibm-sel
runtime/runtime-rs: Set shared_fs to none for IBM SEL in config file
2025-07-09 18:30:08 +02:00
Hyounggyu Choi
bca31d5a4d runtime/runtime-rs: Set shared_fs to none for IBM SEL in config file
In line with configuration for other TEEs, shared_fs should
be set to none for IBM SEL. This commit updates the value for
runtime/runtime-rs.

Signed-off-by: Hyounggyu Choi <Hyounggyu.Choi@ibm.com>
2025-07-09 14:22:28 +02:00
Steve Horsman
967f66f677 Merge pull request #11380 from arvindskumar99/sev-deprecation
Sev deprecation
2025-07-09 11:38:13 +01:00
stevenhorsman
f96b8fb690 kata-ctl: Update expected test failure message
Update expected error after url crate bump

Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2025-07-09 11:34:27 +01:00
stevenhorsman
b7bf46fdfa versions: Bump idna crate to >= 1.0.4
Bump url, reqwests and idna crates in order to move away from
idna <1.0.3 and remediate CVE-2024-12224.

Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2025-07-09 11:34:27 +01:00
stevenfryto
3c7a670129 runtime: Fix rootlessDir not correctly set in rootless VMM mode
Previously, the rootlessDir variable in `src/runtime/virtcontainers/pkg/rootless.go` was initialized at
package load time using `os.Getenv("XDG_RUNTIME_DIR")`. However, in rootless
VMM mode, the correct value of $XDG_RUNTIME_DIR is set later during runtime
using os.Setenv(), so rootlessDir remained empty.

This patch defers the initialization of rootlessDir until the first call
to `GetRootlessDir()`, ensuring it always reflects the current environment
value of $XDG_RUNTIME_DIR.

Fixes: #11526

Signed-off-by: stevenfryto <sunzitai_1832@bupt.edu.cn>
2025-07-09 09:51:48 +08:00
Arvind Kumar
ecac3d2d28 runtime: Removing runtime logic for SEV
Removing runtime SEV functionality,
such as the kbs, ovmf, VMSA handling,
and SEV configs as part of deprecating
SEV from kata.

Co-authored-by: Adithya Krishnan Kannan <AdithyaKrishnan.Kannan@amd.com>
Signed-off-by: Arvind Kumar <arvinkum@amd.com>
2025-07-07 11:17:32 -05:00
alex.lyn
fcaade24f4 runtime-rs: add initdata annotation for remote hypervisor
Add init data annotation within preparing remote hypervisor annotations
when prepare vm, so that it can be passed within CreateVMRequest.

Signed-off-by: alex.lyn <alex.lyn@antgroup.com>
2025-07-07 12:46:05 +01:00
Steve Horsman
1c718dbcdd Merge pull request #11506 from stevenhorsman/remove-atty-dependency
Remove atty dependency
2025-07-04 10:46:28 +01:00
Alex Lyn
2e35a8067d Merge pull request #11482 from Apokleos/fix-force-guestpull
runtime-rs:  refactor and fix the implementation of guest-pull
2025-07-04 11:29:33 +08:00
stevenhorsman
7ffbdf7b3a mem-agent: Remove structopts crate
structopt features were integrated into clap v3 and so is not
actively updated and pulls in the atty crate which has a security
advisory, so update clap, remove structopts, update the code that
used it to remove the outdated dependencies.

Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2025-07-04 09:43:34 +08:00
stevenhorsman
7845129bdc versions: Bump slog-term to 2.9.1
slog-term 2.9.0 included atty, which is unmaintained
as has a security advisory GHSA-g98v-hv3f-hcfr,
so bump the version across our components to remove
this dependency.

Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2025-07-04 09:43:34 +08:00
alex.lyn
2b95facc6f kata-type: Relax Mandatory source Field Check in Guest-Pull Mode
Previously, the source field was subject to mandatory checks. However,
in guest-pull mode, this field doesn't consistently provide useful
information. Our practical experience has shown that relying on this
field for critical data isn't always necessary.

In other aspect, not all cases need mandatory check for KataVirtualVolume.
based on this fact, we'd better to make from_base64 do only one thing and
remove the validate(). Of course, We also keep the previous capability to
make it easy for possible cases which use such method and we rename it
clearly with from_base64_and_validate.

This commit relaxes the mandatory checks on the KataVirtualVolume specifically
for guest-pull mode, acknowledging its diminished utility in this context.

Signed-off-by: alex.lyn <alex.lyn@antgroup.com>
2025-07-03 17:07:20 +08:00
alex.lyn
8f8b196705 runtime-rs: refactor merging metadata within image_pull
refactor implementation for merging metadata.

Signed-off-by: alex.lyn <alex.lyn@antgroup.com>
2025-07-03 17:07:08 +08:00
Fupan Li
fb1c35335a runtime-rs: make the resize_vcpu sync
When hot plugging vcpu in dragonball hypervisor, use the synchronization
interface and wait until the hot plug cpu is executed in the guest
before returning. This ensures that the subsequent device hot plug will
not conflict with the previous call.

Signed-off-by: Fupan Li <fupan.lfp@antgroup.com>
2025-07-03 15:11:36 +08:00
Fupan Li
72a38457f0 dragonball: make the resize_vcpu api support sync
Let dragonball's resize_vcpu api support synchronization, and only
return after the hot-plug of the CPU is successfully executed in the
guest kernel. This ensures that the subsequent device hot-plug operation
can also proceed smoothly.

Signed-off-by: Fupan Li <fupan.lfp@antgroup.com>
2025-07-03 15:11:36 +08:00
Alex Lyn
210844ce6b Merge pull request #11509 from teawater/agent_test
kata-agent: mount.rs: Fix warning of test
2025-07-03 15:05:04 +08:00
Alex Lyn
95d513b379 Merge pull request #11423 from zhaodiaoer/test
test: fix broken testing code in libs
2025-07-03 11:15:39 +08:00
teawater
0347698c59 kata-agent: mount.rs: Fix warning of test
Got follow warning with make test of kata-agent:
   Compiling rustjail v0.1.0 (/data/teawater/kata-containers/src/agent/rustjail)
   Compiling kata-agent v0.1.0 (/data/teawater/kata-containers/src/agent)
warning: unused import: `std::os::unix::fs`
    --> rustjail/src/mount.rs:1147:9
     |
1147 |     use std::os::unix::fs;
     |         ^^^^^^^^^^^^^^^^^
     |
     = note: `#[warn(unused_imports)]` on by default

This commit fixes it.

Fixes: #11508

Signed-off-by: teawater <zhuhui@kylinos.cn>
2025-07-03 10:01:19 +08:00
alex.lyn
7a59d7f937 runtime-rs: Import the public const value from libs
Introduce a const value `KATA_VIRTUAL_VOLUME_PREFIX` defined in the libs/kata-types,
and it'll be better import such const value from there.

Signed-off-by: alex.lyn <alex.lyn@antgroup.com>
2025-07-03 09:42:17 +08:00
Saul Paredes
e7b9eddced Merge pull request #11248 from microsoft/archana1/storages
genpolicy: add validation for storages
2025-07-01 10:02:10 -07:00
Fabiano Fidêncio
07b41c88de Merge pull request #11490 from Apokleos/fix-noise
runtime-rs: Fix noise with frequently appearing in unstaged changes
2025-07-01 17:43:41 +02:00
Archana Choudhary
6932beb01f policy: fix parse errors in rules.rego
This patch fixes the rules.rego file to ensure that the
policy is correctly parsed and applied by opa.

Signed-off-by: Archana Choudhary <archana1@microsoft.com>
2025-07-01 12:43:41 +00:00
Archana Choudhary
abbe1be69f tests: enable confidential_guest setting for coco
This commit updates the `tests_common.sh` script
to enable the `confidential_guest`
setting for the coco tests in the Kubernetes
integration tests.

Signed-off-by: Archana Choudhary <archana1@microsoft.com>
2025-07-01 10:35:20 +00:00
Archana Choudhary
9dd365fdb5 genpolicy: fix mount source check in rules.rego
This commit fixes the mount source check in rules.rego.

Signed-off-by: Archana Choudhary <archana1@microsoft.com>
2025-07-01 10:35:20 +00:00
Archana Choudhary
1cbea890f1 genpolicy: tests: update testcases for execprocess
This patch removes storages from the testcases.json file for execprocess.
This is because input storage objects are invalid for two reasons:
1. "io.katacontainers.fs-opt.layer=" is missing option in annotations.
2. by default, we don't have host-tarfs-dm-verity enabled, so the storage
objects are not created in policy.

Signed-off-by: Archana Choudhary <archana1@microsoft.com>
---
2025-07-01 10:35:20 +00:00
Archana Choudhary
6adec0737c genpolicy: add rules for image_guest_pull storage
This patch introduces some basic checks for the
`image_guest_pull` storage type in the genpolicy tool.

Signed-off-by: Archana Choudhary <archana1@microsoft.com>
2025-07-01 10:35:20 +00:00
Archana Choudhary
bd2dc1422e genpolicy: add test for container images having volumes
This patch adds a test case to genpolicy for container images that have volumes.
Examples of such container images include:
 - quay.io/opstree/redis
 - https://github.com/kubernetes/examples/blob/master/cassandra/image/Dockerfile

Signed-off-by: Archana Choudhary <archana1@microsoft.com>
2025-07-01 10:35:20 +00:00
Archana Choudhary
d7f998fbd5 genpolicy: tests: update test for emptydir volumes
This patch
  - updates testcases.json for emptydir volumes/storages

Signed-off-by: Archana Choudhary <archana1@microsoft.com>
2025-07-01 10:35:20 +00:00