Commit Graph

2065 Commits

Author SHA1 Message Date
Xuewei Niu
beea0c34c5
Merge pull request #11060 from kata-containers/sprt/vfsd-metadata
runtime: virtio-fs: Support "metadata" cache mode
2025-08-08 11:13:57 +08:00
Aurélien Bombo
6d96875d04 runtime: virtio-fs: Support "metadata" cache mode
The Rust virtiofsd supports a "metadata" cache mode [1] that wasn't
present in the C version [2], so this PR adds support for that.

 [1] https://gitlab.com/virtio-fs/virtiofsd
 [2] https://qemu.weilnetz.de/doc/5.1/tools/virtiofsd.html#cmdoption-virtiofsd-cache

Signed-off-by: Aurélien Bombo <abombo@microsoft.com>
2025-08-07 21:24:40 +08:00
Christophe de Dinechin
ec480dc438 qemu: Respect the JSON schema for hot plug
When hot-plugging CPUs on QEMU, we send a QMP command with JSON
arguments. QEMU 9.2 recently became more strict[1] enforcing the
JSON schema for QMP parameters. As a result, running Kata Containers
with QEMU 9.2 results in a message complaining that the core-id
parameter is expected to be an integer:

```
qmp hotplug cpu, cpuID=cpu-0 socketID=1, error:
QMP command failed:
Invalid parameter type for 'core-id', expected: integer
```

Fix that by changing the core-id, socket-id and thread-id to be
integer values.

[1]: be93fd5372

Fixes: #11633

Signed-off-by: Christophe de Dinechin <dinechin@redhat.com>
2025-08-07 09:13:57 +02:00
Markus Rudy
f7a36df290 runtime: generate proto files
The generated Go bindings for the agent are out of date. This commit
was produced by running
src/agent/src/libs/protocols/hack/update-generated-proto.sh with
protobuf compiler versions matching those of the last run, according to
the generated code comments.

Since there are new RPC methods, those needed to be added to the
HybridVSockTTRPCMockImp.

Signed-off-by: Markus Rudy <mr@edgeless.systems>
2025-07-31 17:58:25 +01:00
Ruoqing He
3ec10b3721 runtime: clh: Re-generate client code against v47.0
Re-generates the client code against Cloud Hypervisor v47.0.

Note: The client code of cloud-hypervisor's OpenAPI is automatically
generated by openapi-generator.

Signed-off-by: Ruoqing He <heruoqing@iscas.ac.cn>
2025-07-25 20:44:14 +02:00
Fabiano Fidêncio
6dc4c0faae
Merge pull request #11589 from fidencio/topic/fix-tdx-qemu-path-for-non-gpu
qemu: tdx: Fix binary path for non-gpu TDX
2025-07-18 17:24:00 +02:00
Fabiano Fidêncio
3143787f69 qemu: tdx: Fix binary path for non-gpu TDX
On commit 90bc749a19, we've changed the
QEMUTDXPATH in order to get it to work with GPUs, but the change broke
the non-GPU TDX use-case, which depends on the distro binary.

Signed-off-by: Fabiano Fidêncio <fidencio@northflank.com>
2025-07-18 15:26:27 +02:00
Fabiano Fidêncio
17ce44083c runtime: Remove reference to sev package
Otherwise it'll just break static checks.

Signed-off-by: Fabiano Fidêncio <fidencio@northflank.com>
2025-07-18 12:49:54 +02: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
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
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
Gao Xiang
9079c8e598 runtime: improve EROFS snapshotter support
To better support containerd 2.1 and later versions, remove the
hardcoded `layer.erofs` and instead parse `/proc/mounts` to obtain the
real mount source (and `/sys/block/loopX/loop/backing_file` if needed).

If the mount source doesn't end with `layer.erofs`, it should be marked
as unsupported, as it may be a filesystem meta file generated by later
containerd versions for the EROFS flattened filesystem feature.

Also check whether the filesystem type is `overlay` or not, since the
containerd mount manager [1] may change it after being introduced.

[1] https://github.com/containerd/containerd/issues/11303

Fixes: f63ec50ba3 ("runtime: Add EROFS snapshotter with block device support")
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
2025-06-26 10:12:12 +08:00
Xuewei Niu
9b4518f742
Merge pull request #11359 from pawelbeza/fix-logs-on-virtiofs-shutdown
Fix logging on virtiofs shutdown
2025-06-16 17:06:29 +08:00
Steve Horsman
64c95cb996
Merge pull request #11389 from kata-containers/checkout-persist-credentials-false
workflows: Set persist-credentials: false on checkout
2025-06-16 09:58:22 +01:00
Paweł Bęza
91db41227f runtime: Fix logging on virtiofs shutdown
Fixes a confusing log message shown when Virtio-FS is disabled.
Previously we logged “The virtiofsd had stopped” regardless of whether Virtio-FS was actually enabled or not.

Signed-off-by: Paweł Bęza <pawel.beza99@gmail.com>
2025-06-13 15:59:52 +02:00
stevenhorsman
99e70100c7 workflows: Set persist-credentials: false on checkout
By default the checkout action leave the credentials
in the checked-out repo's `.git/config`, which means
they could get exposed. Use persist-credentials: false
to prevent this happening.

Note: static-checks.yaml does use git diff after the checkout,
but the git docs state that git diff is just local, so doesn't
need authentication.

Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2025-06-10 10:33:41 +01:00
Dan Mihai
1aeef52bae clh: runtime: add disable_image_nvdimm support
Allow users to build using DEFDISABLEIMAGENVDIMM=true if they want to
set disable_image_nvdimm=true in configuration-clh.toml.

disable_image_nvdimm=false is the default config value.

Also, use virtio-blk instead of nvdimm if disable_image_nvdimm=true in
configuration-clh.toml.

Signed-off-by: Dan Mihai <dmihai@microsoft.com>
2025-06-10 02:00:52 +00:00
Dan Mihai
0dd9325264 qemu: runtime: build variable for disable_image_nvdimm=true
Allow users to build using DEFDISABLEIMAGENVDIMM=true if they
want to set disable_image_nvdimm=true in configuration-qemu*.toml.

disable_image_nvdimm=false is the default configuration value.

Note that the value of disable_image_nvdimm gets ignored for
platforms using "confidential_guest = true".

Signed-off-by: Dan Mihai <dmihai@microsoft.com>
2025-06-10 01:57:42 +00:00
Dan Mihai
d51e0c9875 snp: gpu: comment out disable_image_nvdimm config
Comment out "disable_image_nvdimm = true" in:

- configuration-qemu-snp.toml
- configuration-qemu-nvidia-gpu-snp.toml

for consistency with the other configuration-qemu*.toml files.

Those two platforms are using "confidential_guest = true", and therefore
the value of disable_image_nvdimm gets ignored.

Signed-off-by: Dan Mihai <dmihai@microsoft.com>
2025-06-10 01:44:51 +00:00
Shunsuke Kimura
5193cfedca runtime: remove hotplug_vfio_on_root_bus from toml
In this commit, hotplug_vfio_on_root_bus parameter is removed.
<dd422ccb69>

pcie_root_port parameter description
(`This value is valid when hotplug_vfio_on_root_bus is true and
machine_type is "q35"`) will have no value,
and not completely valid, since vrit or DB as also support for root-ports and CLH as well.
so removed.

Fixes: #11316

Co-authored-by: Zvonko Kaiser <zkaiser@nvidia.com>
Signed-off-by: Shunsuke Kimura <pbrehpuum@gmail.com>
2025-06-05 21:53:06 +09:00
Xynnn007
39aa481da1 runtime: fix initdata support for SNP
the qemu commandline of SNP should start with `sev-snp-guest`, and then
following other parameters separeted by ','. This patch fixes the
parameter order.

Signed-off-by: Xynnn007 <xynnn@linux.alibaba.com>
2025-06-02 20:33:19 +08:00
Champ-Goblem
ef642fe890 runtime: fix cgroupv2 deletion when sandbox_cgroup_only=false
Currently, when a new sandbox resource controller is created with cgroupsv2 and sandbox_cgroup_only is disabled,
the cgroup management falls back to cgroupfs. During deletion, `IsSystemdCgroup` checks if the path contains `:`
and tries to delete the cgroup via systemd. However, the cgroup was originally set up via cgroupfs and this process
fails with `lstat /sys/fs/cgroup/kubepods.slice/kubepods-besteffort.slice/....scope: no such file or directory`.

This patch updates the deletion logic to take in to account the sandbox_cgroup_only=false option and in this case uses
the cgroupfs delete.

Fixes: #11036
Signed-off-by: Champ-Goblem <cameron@northflank.com>
2025-05-30 17:51:31 +02:00
stevenhorsman
088e97075c workflow: Add top-level permissions
Set:
```
permissions:
  contents: read
```
as the default top-level permissions explicitly
to conform to recommended security practices e.g.
https://github.com/ossf/scorecard/blob/main/docs/checks.md#token-permissions
2025-05-28 19:34:28 +01:00
Paul Meyer
c4815eb3ad runtime: add option to force guest pull
This enables guest pull via config, without the need of any external
snapshotter. When the config enables runtime.experimental_force_guest_pull, instead of
relying on annotations to select the way to share the root FS, we always
use guest pull.

Co-authored-by: Markus Rudy <mr@edgeless.systems>
Signed-off-by: Paul Meyer <katexochen0@gmail.com>
2025-05-27 12:42:00 +02:00
Fabiano Fidêncio
6c9b199ef1
Merge pull request #11289 from BbolroC/fix-vfio-coldplug
runtime: Preserve hotplug devices for vfio-coldplug mode
2025-05-21 09:48:25 +02:00
Steve Horsman
2871c31162
Merge pull request #11273 from mythi/tdx-qemu-params
config: update QEMU TDX configuration
2025-05-20 10:22:59 +01:00
Steve Horsman
cfdccaacb3
Merge pull request #11283 from Rtoax/p002-fix-typo
config: Fix typos
2025-05-19 14:59:37 +01:00
Hyounggyu Choi
2fd2cd4a9b runtime: Preserve hotplug devices for vfio-coldplug mode
Fixes: #11288

This commit appends hotplug devices (e.g., persistent volume)
to deviceInfos when `vfio_mod` is `vfio` and `cold_plug_vfio`
is set to one except `no-port`. For details, please visit the issue.

Signed-off-by: Hyounggyu Choi <Hyounggyu.Choi@ibm.com>
2025-05-19 13:46:49 +02:00
Pradipta Banerjee
9f9841492e runtime: Fix logging for remote hypervisor
Need to use hvLogger

Fixes: #11286

Signed-off-by: Pradipta Banerjee <pradipta.banerjee@gmail.com>
2025-05-19 07:01:59 -04:00
Rong Tao
914730d948 config: Fix typos
devie should be device

Signed-off-by: Rong Tao <rongtao@cestc.cn>
2025-05-19 14:19:22 +08:00
Fabiano Fidêncio
219d6e8ea6
Merge pull request #11257 from mythi/coco-guest-hardening
confidential guest kernel hardening changes
2025-05-16 08:52:36 +02:00
Mikko Ylinen
ff851202e6 config: update QEMU TDX configuration
Drop '-vmx-rdseed-exit' from '-cpu host' QEMU options. The history
of it is unknown but it's likely related to early TDX enablement.

TD pods start up fine without it (tested by manually editing the
configuration file) and it's also not used elsewhere.

Keep TDXCPUFEATURES for now in case a need for it shows up later.

Signed-off-by: Mikko Ylinen <mikko.ylinen@intel.com>
2025-05-15 15:43:24 +03:00
Seunguk Shin
560e718979 runtime: Add edk2 to configuration-qemu.toml for arm64
The edk2 is required for memory hot plug on qemu for arm64.
This adds the edk2 to configuration-qemu.toml for arm64.

Signed-off-by: Seunguk Shin <seunguk.shin@arm.com>
Reviewed-by: Nick Connolly <nick.connolly@arm.com>
2025-05-15 10:12:31 +01:00
RuoqingHe
cd4c3e89e1
Merge pull request #11243 from kata-containers/dependabot/go_modules/src/runtime/github.com/opencontainers/runc-1.2.0
build(deps): bump github.com/opencontainers/runc from 1.1.12 to 1.2.0 in /src/runtime
2025-05-13 17:02:35 +02:00
stevenhorsman
b3825829d8 versions: Bump golang.org/x/oauth2
Update module to remediate
[CVE-2025-22868](https://www.cve.org/CVERecord?id=CVE-2025-22868)

Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2025-05-13 11:00:35 +01:00
Mikko Ylinen
ab29c8c979 runtime: do not add virtio-rng-pci device for confidential guests
Adding:
"-object rng-random,id=rng0,filename=/dev/urandom -device
virtio-rng-pci,rng=rng0"

for confidential guests is not necessary as the RNG source cannot
be trusted and the guest kernel has the driver already disable as well.

Signed-off-by: Mikko Ylinen <mikko.ylinen@intel.com>
2025-05-12 17:14:51 +03:00
Hyounggyu Choi
4fac1293bd runtime/config: Add VFIO config for IBM SEL
With #11076 merged, a VFIO configuration is needed in the runtime
when IBM SEL is involved (e.g., qemu-se or qemu-se-runtime-rs).

For the Go runtime, we already have a nightly test
(e.g., https://github.com/kata-containers/kata-containers/actions/runs/14964175872/job/42031097043)
in which this change has been applied.
For the Rust runtime, the feature has not yet been migrated.
Thus, this change serves as a placeholder and a reminder for future implementation.

Signed-off-by: Hyounggyu Choi <Hyounggyu.Choi@ibm.com>
2025-05-12 14:58:29 +02:00
stevenhorsman
17843e50bb runtime: Switch userns packages
Switch imports to resolve:
```
SA1019: "github.com/opencontainers/runc/libcontainer/userns" is deprecated:
use github.com/moby/sys/userns
```

Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2025-05-08 11:04:11 +01:00
dependabot[bot]
2c80a3edce build(deps): bump github.com/opencontainers/runc in /src/runtime
Bumps [github.com/opencontainers/runc](https://github.com/opencontainers/runc) from 1.1.12 to 1.2.0.
- [Release notes](https://github.com/opencontainers/runc/releases)
- [Changelog](https://github.com/opencontainers/runc/blob/main/CHANGELOG.md)
- [Commits](https://github.com/opencontainers/runc/compare/v1.1.12...v1.2.0)

---
updated-dependencies:
- dependency-name: github.com/opencontainers/runc
  dependency-version: 1.2.0
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2025-05-08 11:02:16 +01:00
Fabiano Fidêncio
f981e8a904
Merge pull request #10833 from stevenhorsman/crio-annotations-update
Crio annotations update
2025-05-07 16:05:24 +02:00
RuoqingHe
7bdfea0041
Merge pull request #11123 from kimullaa/add-path-for-kata-deploy
runtime: Add Path for kata-deploy
2025-05-07 00:25:12 +08:00
stevenhorsman
5472662b33 runtime: Fix Incorrect conversion between integer types
Fix the high severity codeql issue by checking the
value is in bounds before converting

Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2025-05-06 15:18:37 +01:00
stevenhorsman
4de79b9821 runtime: Ignoring deprecated warning.
In the latest oci-spec, the prestart hook is deprecated.
However, the docker & nerdctl tests failed when I switched
to one of the newer hooks which don't run at quite the same time,
so ignore the deprecation warnings for now to unblock the security fix

Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2025-05-06 15:18:37 +01:00
stevenhorsman
37dda6060c runtime: Re-vendor
Re-run `make vendor` after the podman -> crio annotations
change

Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2025-05-06 15:18:37 +01:00
stevenhorsman
3740ce6e7b runtime: Update crio annotations
We've been using the
github.com/containers/podman/v4/pkg/annotations module
to get cri-o annotations, which has some major CVEs in, but
in v5 most of the annotations were moved into crio (from 1.30)
(see https://github.com/cri-o/cri-o/pull/7867). Let's switch
to use the cri-o annotations module instead and remediate
CVE-2024-3056.

Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2025-05-06 15:18:37 +01:00
Fabiano Fidêncio
78bf9d7500
Merge pull request #11232 from lifupan/mtu
runtime: add the mtu support for updating routes
2025-05-06 15:55:04 +02:00
Shunsuke Kimura
7177ab3827 runtime: execute using abs path
Fixes: #11123

Signed-off-by: Shunsuke Kimura <pbrehpuum@gmail.com>
2025-05-06 21:17:06 +09:00