Commit Graph

10377 Commits

Author SHA1 Message Date
Bin Liu
83d052f82b
Merge pull request #4476 from LitFlwr0/vcpu-pinning-frq
vCPUs pinning support for Kata Containers
2022-11-07 10:37:22 +08:00
Guanglu Guo
daeee26a1e cloud-hypervisor: Fix GetThreadIDs function
Get vcpu thread-ids by reading cloud-hypervisor process tasks information.

Fixes: #5568

Signed-off-by: Guanglu Guo <guoguanglu@qiyi.com>
2022-11-05 17:23:19 +08:00
Bin Liu
427b01e298
Merge pull request #5548 from justxuewei/fix/share-fs-permission
runtime-rs: fix shared volume permission issue
2022-11-04 21:21:50 +08:00
Fabiano Fidêncio
40d514aa2c github: Parallelise static checks
Although introducing an awful amount of code duplication, let's
parallelise the static checks in order to reduce its time and the space
used in the VMs running those.

While I understand there may be ways to make the whole setup less
repetitive and error prone, I'm taking the approach of:
* Make it work
* Make it right
* Make it fast

So, it's clear that I'm only attempting to make it work, and I'd
appreciate community help in order to improve the situation here.  But,
for now, this is a stopgap solution.

JFYI, the time needed for run the tests on the `main` branch went down
from ~110 minutes to ~60 minutes.  Plus, we're not running those on a
single VM anymore, which decreases the change to hit the space limit.

Reference: https://github.com/kata-containers/kata-containers/actions/runs/3393468605/jobs/5640842041

Ideally, each one of the following tests should be also split into
smaller tests, each test for one component, for instance.
* static-checks
* compiler-checks
* unit-tests
* unit-tests-as-root

Fixes: #5585

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2022-11-04 13:41:16 +01:00
Fabiano Fidêncio
656a3e06a7
Merge pull request #5580 from fidencio/topic/CC-build-and-provide-yet-another-tdx-runtime-class
CC | config: Add specific config for TDX + EAA KBC
2022-11-04 13:22:36 +01:00
Fabiano Fidêncio
1b93cd1661
Merge pull request #5546 from jimcadden/allow_empty_keysets
CC | runtime: Enable kernel hashes for all SEV guests
2022-11-04 13:22:01 +01:00
LitFlwr0
2508d39b7c runtime: added vcpus pinning logics
Core VCPU threads pinning logics for issue 4476. Also provided docs.

Fixes:#4476
Signed-off-by: LitFlwr0 <861690705@qq.com>
2022-11-04 17:52:42 +08:00
Zhongtao Hu
fef8e92af1 runtime-rs:add hypervisor interface capabilities
1. be able to check does hypervisor support use block device, block
device hotplug, multi-queue, and share file

2. be able to set the hypervisor capability of using block device, block
device hotplug, multi-queue, and share file

Fixes: #5569
Signed-off-by: Zhongtao Hu <zhongtaohu.tim@linux.alibaba.com>
2022-11-04 09:24:36 +08:00
Bin Liu
b0c7bcce7c
Merge pull request #5556 from ManaSugi/runk/fix-kill-behavior
runk: Ignore an error when calling kill cmd with --all option
2022-11-04 08:42:27 +08:00
Bin Liu
02fa6b8dad
Merge pull request #5557 from ManaSugi/runk/update-cargolock-libseccomp
runk: Upgrade libseccomp crate to v0.3.0 in Cargo.lock
2022-11-04 08:41:45 +08:00
Fabiano Fidêncio
bb38901550
Merge pull request #5571 from jodh-intel/snap-unbreak-docker
snap: Unbreak docker install
2022-11-03 23:47:07 +01:00
Jim Cadden
411482bf19 runtime: Enable kernel hashes for all SEV guests
This commit adds the `kernel-hashes=on` flag to the QEMU command line
for all SEV guests (previously, this was only enabled for SEV guests
with `guest_pre_attestation=on`. This change allows the AmdSev firmware
to be used for both encrypted and non-encrypted container images.

**Note:** This change makes the AmdSev OVMF build a requirement for all
SEV guests. The standard host OVMF package will no longer work.

Fixes #5307.

Signed-off-by: Jim Cadden <jcadden@ibm.com>
2022-11-03 08:23:17 -04:00
Steve Horsman
3dd655d60d
Merge pull request #5337 from dubek/runtime-add-sev-tests
CCv0: runtime/pkg/sev: Add unit tests; allow measurement without kernel
2022-11-03 11:15:16 +00:00
Fabiano Fidêncio
1f799d6a29 config: Add AGENT_AA_KBC_PARAMS to the kernel config
Let's ensure we add the option for the user, at build time, to set the
AGENT_AA_KBC_PARAMS passed to the agent, via the kernel command line.

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2022-11-03 11:37:14 +01:00
Fabiano Fidêncio
b14921937a config: Add specific config for TDX + EAA KBC
As we're switching TDX to using EAA KBC instead of OfflineFS KBC, let's
add the configuration files needed for testing this before we fully
switch TDX to using such an image.

Fixes: #5563

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2022-11-03 11:35:45 +01:00
Fabiano Fidêncio
c72fdaf916 packaging: Build TDX specific guest image
The specific TDX image relies on having EAA KBC, instead of using the
default `offline_fs_kbc`.

This image is, with this commit, built and distributed, but not yet used
by TDX specific configurations, which will be done in a follow-up
commit.

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2022-11-03 11:35:45 +01:00
Fabiano Fidêncio
05db886e27 osbuilder: Remove non-needed packages at the end
Instead of removing the non-needed packages under `/usr/share` and then
installing new components, let's make sure we do the removal at the end
of our script.

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2022-11-03 11:35:45 +01:00
Fabiano Fidêncio
af75ce04c1 osbuilder: Manually add universe repo
Let's do that instead of updating and installing the
`software-properties-common` package, as it reduces the final size of
the image.

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2022-11-03 11:35:45 +01:00
Fabiano Fidêncio
68956ad127 osbuilder: Add /etc/tdx-attest.conf when using eaa_kbc
First of all, EAA KBC is only used with TDX, thus we can safely assume
that eaa_kbc means TDX, at least for now.

A `/etc/tdx-attest.conf` file, with the data "port=4050" is needed as
that's the default configuration for the Quote Generation Service (QGS)
which is present on the guest side.

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2022-11-03 11:35:45 +01:00
Fabiano Fidêncio
6f16071359 guest-image: Allow passing the image / initrd suffix
This will become very handy by the moment we start building different
images targetting different TEEs.

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2022-11-03 11:35:45 +01:00
Fabiano Fidêncio
95fbe46891
Merge pull request #5552 from stevenhorsman/sig-ver-param
Sig ver param
2022-11-03 11:22:31 +01:00
Pavel Mores
27b1913584 runtime-rs: blanks filled & fixes made to virtiofsd launch
The 'config' argument to ShareVirtioFsStandalone::new() is now actually
used, taking care of an explicit TODO.

If a shared path doesn't exist in ShareVirtioFsStandalone::virtiofsd_args()
it is now created instead of returning an error, thus following
ShareVirtioFsInline's suit.

The '-o vhost_user_socket=...' command line argument doesn't seem to be
supported by newer versions of virtiofsd so we replace it with
'--socket-path' which should be functionally equivalent according to docs.

Fixes #5572

Signed-off-by: Pavel Mores <pmores@redhat.com>
2022-11-03 08:38:59 +01:00
stevenhorsman
360e01c0f4 agent: Set image_client security_validate
Replace hard-coded aa_kbc_param check to set the image_client's
security_validate, with reading the setting from the agent config

Fixes: #4888
Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2022-11-02 21:28:33 +00:00
Fabiano Fidêncio
b6bf1c3f2c
Merge pull request #5574 from fidencio/topic/CC-increase-clh-timeouts
CC | clh: Increase the timeouts when using Conf Guests
2022-11-02 21:45:01 +01:00
Fabiano Fidêncio
76ef07a22d clh: Increase the timeouts when using Conf Guests
Launching a pod with measured boot enabled seems to be taking longer
than expected with Cloud Hypervisor, which leads to hitting a timeout
limit.

Let's double those timeout limits for now.

Fixes: #5576

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2022-11-02 18:36:21 +01:00
stevenhorsman
9aa4afee63 runtime: Disable signature verification in config
Add agent.enable_signature_verification=false to the kernel_params
default config to get backwards compatibility in config.
Note the the agent config will default this setting to true for security
reasons if it's unset

Fixes: #4888
Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2022-11-02 17:21:50 +00:00
stevenhorsman
46a6c52ef4 agent: Add enable_signature_verification config
- Add a new agent config parameter enable_signature_verification which
defaults to true for security reasons
- Add unit tests to check parsing and defaults

Fixes: #4888
Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2022-11-02 17:21:50 +00:00
Fabiano Fidêncio
5b1df532da
Merge pull request #5562 from fitzthum/params_cmdline
CC | Agent: Allow agent config to be overwritten
2022-11-02 18:20:01 +01:00
Tobin Feldman-Fitzthum
d71e7bbd59 Agent: Allow agent config to be overwritten
Allows parameters in the agent config file to be overwritten
by the kernel commandline. Does not change trust model since
the commandline is measured.

Makes sure to set endpoints_allowed correctly.

Fixes: #5173

Signed-off-by: Tobin Feldman-Fitzthum <tobin@ibm.com>
Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2022-11-02 13:27:23 +00:00
James O. D. Hunt
990e6359b7 snap: Unbreak docker install
It appears that _either_ the GitHub workflow runners have changed their
environment, or the Ubuntu archive has changed package dependencies,
resulting in the following error when building the snap:

```
Installing build dependencies: bc bison build-essential cpio curl docker.io ...

    :

The following packages have unmet dependencies:
docker.io : Depends: containerd (>= 1.2.6-0ubuntu1~)
E: Unable to correct problems, you have held broken packages.
```

This PR uses the simplest solution: install the `containerd` and `runc`
packages. However, we might want to investigate alternative solutions in
the future given that the docker and containerd packages seem to have
gone wild in the Ubuntu GitHub workflow runner environment. If you
include the official docker repo (which the snap uses), a _subset_ of
the related packages is now:

- `containerd`
- `containerd.io`
- `docker-ce`
- `docker.io`
- `moby-containerd`
- `moby-engine`
- `moby-runc`
- `runc`

Fixes: #5545.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2022-11-02 10:09:03 +00:00
James O. D. Hunt
ca69a9ad6d snap: Use metadata for dependencies
Rather than hard-coding the package manager into the docker part,
use the `build-packages` section to specify the parts package
dependencies in a distro agnostic manner.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2022-11-02 09:50:29 +00:00
Steve Horsman
5f5b4f7da9
Merge pull request #5374 from Alex-Carter01/AA-tag-version
osbuilder: specify Attestation Agent tag for rootfs build
2022-11-01 17:42:35 +00:00
Megan Wright
3623c033c7
Merge pull request #5554 from Megan-Wright/CCv0
CCv0: Merge main into CCv0 branch
2022-11-01 16:42:45 +00:00
Fabiano Fidêncio
fe9ea1351f
Merge pull request #5542 from arronwy/image-rs
CC | agent: Bump pinned version of image-rs to support cosign signature verification
2022-11-01 12:49:33 +01:00
Manabu Sugimoto
df092185ee runk: Upgrade libseccomp crate to v0.3.0 in Cargo.lock
The libseccomp crate was upgraded to v0.3.0 by 4696ead,
but `Cargo.lock` of runk wasn't updated by mistake.
So, this commit updates `Cargo.lock` of runk to the latest dependencies.

Fixes: #5487

Signed-off-by: Manabu Sugimoto <Manabu.Sugimoto@sony.com>
2022-11-01 20:26:33 +09:00
Manabu Sugimoto
16dca4ecd4 runk: Ignore an error when calling kill cmd with --all option
Ignore an error handling that is triggered when the kill command is called
with `--all option` to the stopped container.

High-level container runtimes such as containerd call the kill command with
`--all` option in order to terminate all processes inside the container
even if the container already is stopped. Hence, a low-level runtime
should allow `kill --all` regardless of the container state like runc.

This commit reverts to the previous behavior.

Fixes: #5555

Signed-off-by: Manabu Sugimoto <Manabu.Sugimoto@sony.com>
2022-11-01 20:24:29 +09:00
Megan Wright
61ec234b6a CCv0: Merge main into CCv0 branch
Merge remote-tracking branch 'upstream/main' into CCv0

Fixes: #5553
Signed-off-by: Megan Wright <megan.wright@ibm.com>
2022-11-01 10:55:33 +00:00
Xuewei Niu
b74c18024a runtime-rs: fix shared volume permission issue
Fix the issue where share volumes always have readwrite permission even if
readonly permission is enough.

Fixes: #5549

Signed-off-by: Xuewei Niu <justxuewei@apache.org>
2022-11-01 18:42:19 +08:00
Fabiano Fidêncio
8f56ad57ad
Merge pull request #5544 from fidencio/topic/CC-install-rats-tls-tdx
CC | osbuilder: Install rats-tls-tdx
2022-11-01 09:39:09 +01:00
Chen TaoTao
936fe35acb runtime-rs : fix shim source is ambiguous
In the documentation test, the name shim has multiple potential
sources of import, now give it a clear source.

Fixes: #5535

Signed-off-by: Chen TaoTao <chentt10@chinatelecom.cn>
2022-10-31 19:54:22 -07:00
Fabiano Fidêncio
aa4d803e35
Merge pull request #5533 from arronwy/aa_kbc_params
CC | config: Export aa_kbc_params to be set in guest kernel command line
2022-10-31 22:37:20 +01:00
GabyCT
04f0fcc5eb
Merge pull request #5398 from GabyCT/topic/qemucccached
CCv0: Use cached cc qemu tarball
2022-10-31 14:25:52 -06:00
Gabriela Cervantes
72a13f6064 CCv0: Use cached cc qemu tarball
This PR implements the use of a cached cc qemu tarball to speed up
the CI and avoid building the cc qemu tarball when it is not
necessary.

Fixes #5363

Signed-off-by: Gabriela Cervantes <gabriela.cervantes.tellez@intel.com>
2022-10-31 18:32:17 +00:00
Fabiano Fidêncio
68c962601c
Merge pull request #5537 from GabyCT/updateclh
CC  backport tools: Fix indentation of build static clh script
2022-10-31 18:55:04 +01:00
Wang, Arron
112a3d2bae config: Export aa_kbc_params to be set in guest kernel command line
As we discussed in #5178, user need set aa_kbc_params config without
modify kata guest image, since kernel params is also measured in TEE
boot flow, we make aa_kbc_params can be parsed through kernel cmdline.

Fixes: #5178

Signed-off-by: Wang, Arron <arron.wang@intel.com>
2022-10-31 22:26:02 +08:00
Fabiano Fidêncio
a1571721dd osbuilder: Install rats-tls-tdx
Inclavare released a rats-tls-tdx package, which we depend on for using
verdictd.

Let's install it when using EAA_KBC, as already done for the rats-tls
package.

One thin to note here is that rats-tls-tdx depends on libtdx-attest,
which depends on libprotobuf-c1, thus we had to add the intel-sgx repo
together with enabling the universe channel.

Fixes: #5543

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2022-10-31 13:11:37 +01:00
Fabiano Fidêncio
5885f005f1 ubuntu: 20.04 is focal, not bionic
Let's use the correct OS version name for Ubuntu 20.04.

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2022-10-31 10:46:41 +01:00
Fabiano Fidêncio
30990872f1 ubuntu: Ensure RATS-TLS is only installed on 20.04
We're currently using Ubuntu 20.04 as the base for the Ubuntu rootfs,
meaning that right now there's no issue with the approach currently
taken.  However, if we do a bump of an Ubuntu version, we could face
issues as the rats-tls package is only provided for Ubuntu 20.04.

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2022-10-31 09:26:23 +01:00
Wang, Arron
27affb2a63 agent: Bump pinned version of image-rs to support cosign signature
To support cosign signature verification.

Fix build warning in signal.rs:
error: unused `tokio::sync::MutexGuard` that must be used
  --> src/signal.rs:27:9
   |
27 |         rustjail::container::WAIT_PID_LOCKER.lock().await;
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: `-D unused-must-use` implied by `-D warnings`
   = note: if unused the Mutex will immediately unlock

Fixes: #5541

Signed-off-by: Wang, Arron <arron.wang@intel.com>
2022-10-31 14:44:15 +08:00
snir911
288e337a6f
Merge pull request #5434 from Rouzip/remove-doNetNS
add EnterNetNS in virtcontainers
2022-10-30 11:19:07 +02:00