Commit Graph

15430 Commits

Author SHA1 Message Date
Hyounggyu Choi
e8aa5a5ab7 runtime-rs: Enable virtio-net-ccw for s390x
When using `virtio-net-pci` for IBM SE, the following error occurs:

```
update interface: Link not found (Address: f2:21:48:25:f4:10)
```

On s390x, it is more appropriate to use the CCW type of virtio
network device.
This commit ensures that a subchannel is configured accordingly.

Signed-off-by: Hyounggyu Choi <Hyounggyu.Choi@ibm.com>
2025-03-03 16:34:03 +01:00
Hyounggyu Choi
59c1f0b59b runtime-rs: Suppress kernel parameters for IBM SE
For IBM SE, the following kernel parameters are not required:

- Basic parameters (reboot and systemd-related)
- Rootfs parameters

This commit suppresses these parameters when IBM SE is configured.

Signed-off-by: Hyounggyu Choi <Hyounggyu.Choi@ibm.com>
2025-03-03 16:34:03 +01:00
Hyounggyu Choi
4c8e881a84 runtime-rs: Enable IBM SE support for QEMU
This commit configures the command line for IBM Secure Execution (SE)
and other TEEs. The following changes are made:

- Add a new item `Se` to ProtectionDeviceConfig and handle it at sandbox
- Introduce `add_se_protection_device()` for SE cmdline config
- Bypass rootfs image/initrd validity checks when SE is configured.

Signed-off-by: Hyounggyu Choi <Hyounggyu.Choi@ibm.com>
2025-03-03 16:32:18 +01:00
Zvonko Kaiser
f485e52f75
Merge pull request #10953 from zvonkok/shellcheckrc
ci: Add shellcheckrc
2025-02-27 13:35:23 -05:00
Fabiano Fidêncio
96ed706d20
Merge pull request #10950 from fidencio/topic/skip-arm-check-tests-that-depend-on-virt
ci: arm64: Skip tests that depend on virt on non-virt capable runners
2025-02-27 18:26:32 +01:00
Zvonko Kaiser
abfbc0ab60 ci: Add shellcheckrc
Let's have common rules over all shell files.

Signed-off-by: Zvonko Kaiser <zkaiser@nvidia.com>
2025-02-27 17:11:24 +00:00
Zvonko Kaiser
33460386b9
Merge pull request #10803 from ryansavino/update-confidential-initrd-22.04
versions: update confidential initrd to 22.04
2025-02-27 09:29:36 -05:00
Fabiano Fidêncio
e18e1ec3a8 ci: arm64: Skip tests that depend on virt on non-virt capable runners
The GitHub hosted runners for ARM64 do not provide virtualisation
support, thus we're just skipping the tests as those would check whether
or not the system is "VMContainerCapable".

Signed-off-by: Fabiano Fidêncio <fabiano@fidencio.org>
2025-02-27 14:43:21 +01:00
Wainer Moschetta
5fda6b69e8
Merge pull request #10883 from stevenhorsman/k0s-version-pinning
ci: k8s: Pin k0s version to get cri-o tests back working
2025-02-27 10:11:59 -03:00
Steve Horsman
f3c22411fc
Merge pull request #10930 from stevenhorsman/codeql-config
workflows: Add codeql config
2025-02-27 12:43:41 +00:00
stevenhorsman
d08787774f ci: k8s: Use pinned k0s version
Update the code to install the version of k0s
that we have in our versions.yaml, rather than
just installing the latest, to help our CI being
less stable and prone to breaking due to things
we don't control.

Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2025-02-27 11:33:23 +00:00
stevenhorsman
3fe35c1594 version: Add k0s version
Add external versions support for k0s and
initially pin it at v1.31.5 as our cri-o tests
started failing when v1.32 became the latest

Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2025-02-27 11:33:23 +00:00
Fabiano Fidêncio
6e236fd44c
Merge pull request #10652 from burgerdev/sysctls
genpolicy: support sysctls from PodSpec and environment defaults
2025-02-27 08:25:14 +01:00
Dan Mihai
cb382e1367
Merge pull request #10925 from katexochen/p/fail-on-layer-pull
genpolicy: fail when layer can't be processed
2025-02-26 13:28:38 -08:00
Ryan Savino
ceafa82f2e tests: skip trusted storage tests for qemu-snp
skip tests for trusted storage until #10838 is resolved.

Signed-Off-By: Ryan Savino <ryan.savino@amd.com>
2025-02-26 14:23:57 -06:00
Ryan Savino
a00a7c500a build: initrd rootfs init symlink directly to systemd when no AGENT_INIT
In some cases, /init is not following two levels of symlinks
i.e. /init to /sbin/init to /lib/systemd/systemd
Setting /init directly to /lib/systemd/systemd when AGENT_INIT is not mandated

Signed-Off-By: Ryan Savino <ryan.savino@amd.com>
2025-02-26 14:23:56 -06:00
Markus Rudy
70709455ef genpolicy: support sysctl settings
Sysctls may be added to a container by the Kubernetes pod definition or
by containerd configuration. This commit adds support for the
corresponding PodSecurityContext field and an option to specify
environment-dependent sysctls in the settings file.

The sysctls requested in a CreateContainerRequest are checked against
the sysctls in the pod definition, or if not defined there in the
defaults in genpolicy-settings.json. There is no check for the presence
of expected sysctls, though, because Kubernetes might legitimately
omit unsafe syscalls itself and because default sysctls might not apply
to all containers.

Fixes: #10064
Signed-off-by: Markus Rudy <mr@edgeless.systems>
2025-02-26 18:56:17 +01:00
Steve Horsman
5aa89bc1d7
Merge pull request #10831 from RuoqingHe/ci-riscv64
ci: Enable partial components build-check on riscv
2025-02-26 17:50:47 +00:00
Fabiano Fidêncio
9d8026b4e5
Merge pull request #10654 from burgerdev/cronjob
genpolicy: add get_process_fields to CronJob
2025-02-26 15:13:40 +01:00
Fabiano Fidêncio
7b16df64c9
Merge pull request #10935 from burgerdev/error-messages
runtime: add cause to CDI errors
2025-02-26 14:01:22 +01:00
Fabiano Fidêncio
47a5439a20
Merge pull request #10934 from fidencio/topic/agent-unbreak-non-guest-pull-build
agent: Fix non-guest-pull build
2025-02-26 09:45:22 +01:00
Pavel Mores
c5e560e2d1 runtime-rs: handle ProtectionDevice in resource manager and sandbox
As part of device preparation in Sandbox we check available protection
and create a corresponding ProtectionDeviceConfig if appropriate.  The
resource-side handling is trivial.

Signed-off-by: Pavel Mores <pmores@redhat.com>
2025-02-26 09:11:35 +01:00
Pavel Mores
eb47f15b10 runtime-rs: support ProtectionDevice in qemu-rs
As an example, or a test case, we add some implementation of SEV/SEV-SNP.
Within the QEMU command line generation, the 'Cpu' object is extended to
accomodate the EPYC-v4 CPU type for SEV-SNP.

'Machine' is extended to support the confidential-guest-support parameter
which is useful for other TEEs as well.

Support for emitting the -bios command line switch is added as that seems
to be the preferred way of supplying a path to firmware for SEV/SEV-SNP.

Support for emitting '-object sev-guest' and '-object sev-snp-guest'
with an appropriate set of parameters is added as well.

Signed-off-by: Pavel Mores <pmores@redhat.com>
2025-02-26 09:11:35 +01:00
Pavel Mores
87deb68ab7 runtime-rs: add implementation of ProtectionDevice
ProtectionDevice is a new device type whose implementation structure
matches the one of other devices in the device module.  It is split into
an inner "config" part which contains device details (we implement
SEV/SEV-SNP for now) and the customary outer "device" part which just adds
a device instance ID and the customary Device trait implementation.

Signed-off-by: Pavel Mores <pmores@redhat.com>
2025-02-26 09:11:35 +01:00
Pavel Mores
a3f973db3b runtime-rs: extend SEV/SEV-SNP detection by including a details struct
This matches the existing TDX handling where additional details are
retrieved right away after TDX is detected.  Note that the actual details
(cbitpos) acquisition is NOT included at this time.

This change might seem bigger than it is.  The change itself is just in
protection.rs, the rest are corresponding adjustments.

Signed-off-by: Pavel Mores <pmores@redhat.com>
2025-02-26 09:11:35 +01:00
Pavel Mores
c549d12da7 runtime-rs: parse SEV-SNP related config file settings
The 'sev_snp_guest' default value of 'false' is in compliance with the
golang runtime behaviour.

Signed-off-by: Pavel Mores <pmores@redhat.com>
2025-02-26 09:11:35 +01:00
Markus Rudy
d58f38dfab genpolicy: add get_process_fields to CronJob
This function was accidentally left unimplemented for CronJob, resulting
in runAsUser not being supported there.

Fixes: #10653
Signed-off-by: Markus Rudy <mr@edgeless.systems>
2025-02-26 09:00:04 +01:00
Ruoqing He
ec020399b9 ci: Enable partial components build-check on riscv
Since we have RISC-V builders available now, let's start with
`agent-ctl`, `trace-forwarder` and `genpolicy` components to run
build-checks on these `riscv-builder`s, and gradually add the rest
components when they are ready, to catch up with other architectures
eventually.

This workflow could be mannually triggered, `riscv-builder` will be the
default instance when that is the case.

Signed-off-by: Ruoqing He <heruoqing@iscas.ac.cn>
2025-02-26 15:38:39 +08:00
Markus Rudy
1f6833bd0d runtime: add cause to CDI errors
Adding devices by CDI annotation can fail for a variety of reasons. If
that happens, it's helpful to know the root cause of the issue (CDI spec
missing, malformatted, requested device not present, etc.).

This commit adds the root cause of the CDI device addition to the errors
reported back to the caller. Since this error is bubbled up all the way
back to the shimv2 task.Create handler, it will be visible in Kubernetes
logs and enable fixing the root cause.

Signed-off-by: Markus Rudy <mr@edgeless.systems>
2025-02-26 08:36:15 +01:00
Paul Meyer
9981cdd8a8 genpolicy: fail when layer can't be processed
Currently, if a layer can't be processed, we log this a warning and
continue execution, finally exit with a zero exit code. This can lead
to the generation of invalid policies. One reason a layer might not be
processed is that the pull of that layer fails.

We need all layers to be processed successfully to generate a valid
policy, as otherwise we will miss the verity hash for that layer or
we might miss the USER information from a passwd stored in that layer.
This will cause our VM to not get through the agent's policy validation.

Returning an error instead of printing a warning will cause genpolicy
to fail in such cases.

Signed-off-by: Paul Meyer <katexochen0@gmail.com>
2025-02-26 08:30:59 +01:00
Fabiano Fidêncio
b3b570e4c4 agent: Fix non-guest-pull build
As the guest-pull is a very Confidental Containers specific feature,
let's make sure we, at least, don't break folks who decide to build Kata
Containers' agent without having this feature enabled (for instance, for
the sake of the agent size).

Signed-off-by: Fabiano Fidêncio <fabiano@fidencio.org>
2025-02-25 21:48:41 +01:00
Zvonko Kaiser
04c56a0aaf
Merge pull request #10931 from zvonkok/iommufd-fix
gpu: IOMMUFD fix
2025-02-25 12:50:24 -05:00
Ruoqing He
ed50e31625 build: Reorganize target selection
Architectures here with `musl` available are minority, which is more
suitable for enumeration.

With this change, we are implicitly choosing gnu target for `ppc64le`,
`riscv64` and `s390x`.

Signed-off-by: Ruoqing He <heruoqing@iscas.ac.cn>
2025-02-26 00:56:54 +08:00
Ruoqing He
562911e170 build: Add riscv mapping for common.bash
While installing Rust and Golang in our CI workflow, `arch_to_golang`
and `arch_to_rust` are needed for inferring the correct arch string for
riscv64 architecture.

Signed-off-by: Ruoqing He <heruoqing@iscas.ac.cn>
2025-02-26 00:56:54 +08:00
Ruoqing He
62e2473c32 build: Add riscv64 to utils.mk
Since `ARCH` for `riscv64` is `riscv64gc`, we'll need to override it in
`utils.mk`, and forcing `gnu` target for `riscv64` because `musl` target
is not yet made ready.

Signed-off-by: Ruoqing He <heruoqing@iscas.ac.cn>
2025-02-26 00:56:54 +08:00
Zvonko Kaiser
804e5cd332 gpu: IOMMUFD provide proper ID
We need a proper ID otherwise QEMU sometimes fails with invalid ID.
Use the same pattern as with the old VFIO implementation.

Signed-off-by: Zvonko Kaiser <zkaiser@nvidia.com>
2025-02-25 16:24:17 +00:00
stevenhorsman
c97e9e1592 workflows: Add codeql config
I noticed that CodeQl using the default config hasn't
scanned since May 2024, so figured it would be worth
trying an explicit configuration to see if that gets better results.
It's mostly the template, but updated to be more relevant:
- Only scan PRs and pushes to the `main` branch
- Set a pinned runner version rather than latest (with mac support)
- Edit the list of languages to be scanned to be more relevant
for kata-containers

Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2025-02-25 15:05:43 +00:00
Fabiano Fidêncio
e09ae2cc0b
Merge pull request #10921 from RuoqingHe/drop-redundant-override
build: Drop redundant ARCH override
2025-02-25 14:54:36 +01:00
Fabiano Fidêncio
c01e7f1ed5
Merge pull request #10932 from kata-containers/topic/consolidate-publish-workflow
workflows: Refactor publish workflows
2025-02-25 14:50:40 +01:00
stevenhorsman
5000fca664 workflows: Add build-checks to manual CI
Currently the ci-on-push workflow that runs on PRs runs
two jobs: gatekeeper-skipper.yaml and ci.yaml. In order
to test things like for the error
```
too many workflows are referenced, total: 21, limit: 20
```
on topic branches, we need ci-devel.yaml to have an
extra workflow to match ci-on-push, so add the build-checks
as this is helpful to run on topic branches anyway.

Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2025-02-25 11:38:49 +00:00
stevenhorsman
23434791f2 workflows: Refactor publish workflows
Replace the four different publish workflows with
a single one that take input parameters of the arch
and runner, so reduce the amount of duplicated code
and try and avoid the
```
too many workflows are referenced, total: 21, limit: 20
```
error
2025-02-25 10:49:09 +00:00
Fabiano Fidêncio
e3eb9e4f28
Merge pull request #10929 from kata-containers/topic/enable-arm-tests
arm: ci: k8s: Enable CI
2025-02-24 19:34:28 +01:00
Fabiano Fidêncio
a6186b6244 ci: k8s: arm: Skip "Check the number vcpus are ..." test
See https://github.com/kata-containers/kata-containers/issues/10928

Signed-off-by: Fabiano Fidêncio <fabiano@fidencio.org>
2025-02-24 18:43:24 +01:00
Fabiano Fidêncio
1798804c32 ci: k8s: arm: Skip "Pod quota" test
See https://github.com/kata-containers/kata-containers/issues/10927

Signed-off-by: Fabiano Fidêncio <fabiano@fidencio.org>
2025-02-24 18:43:24 +01:00
Fabiano Fidêncio
053827cacc ci: k8s: arm: Skip "Running within memory constraints" test
See https://github.com/kata-containers/kata-containers/issues/10926

Signed-off-by: Fabiano Fidêncio <fabiano@fidencio.org>
2025-02-24 18:43:24 +01:00
Fabiano Fidêncio
7bd444fa52 ci: Run k8s tests on arm64
Let's take advantege of the current arm64 runners, and make sure we have
those tests running there as well.

Signed-off-by: Fabiano Fidêncio <fabiano@fidencio.org>
Signed-off-by: Kevin Zhao <kevin.zhao@linaro.org>
2025-02-24 18:43:20 +01:00
Aurélien Bombo
16aa6b9b4b
Merge pull request #10911 from kata-containers/sprt/fix-cgroup-race
agent: Fix race condition with cgroup watchers
2025-02-24 10:28:58 -06:00
Ruoqing He
265a751837 build: Drop redundant ARCH override
There are many `override ARCH = powerpc64le` after where `utils.mk` is
included, which are redundant.

Drop those redundant `override`s.

Signed-off-by: Ruoqing He <heruoqing@iscas.ac.cn>
2025-02-24 22:04:28 +08:00
Fabiano Fidêncio
aa30f9ab1f versions: Use jammy for x86_64 confidential initrd
Set confidential initrd to use jammy rootfs

Signed-off-by: Ryan Savino <ryan.savino@amd.com>
2025-02-22 23:57:16 -06:00
Aurélien Bombo
adca339c3c ci: Fix GH throttling in run-nerdctl-tests
Specify a GH API token to avoid the below throttling error:

  https://github.com/kata-containers/kata-containers/actions/runs/13450787436/job/37585810679?pr=10911#step:4:96

Signed-off-by: Aurélien Bombo <abombo@microsoft.com>
2025-02-21 17:52:17 -06:00