Commit Graph

12450 Commits

Author SHA1 Message Date
ChengyuZhu6
8f38dcb850 osbuilder: check rust enviornment before building agent and AA
We should configure the Rust environment when AGENT_SOURCE_BIN is empty or AA_KBC is not empty.

Fixes #7877

Signed-off-by: ChengyuZhu6 <chengyu.zhu@intel.com>
2023-09-13 15:22:49 +08:00
Fabiano Fidêncio
f462c69484 Merge pull request #7880 from ChengyuZhu6/udev
image-builder: fix udev error when using docker to build image
2023-09-13 07:47:35 +02:00
ChengyuZhu6
622bd4e370 agent: create directories to mount filesystem by overlay
When creating a container with a raw disk image using virtio-blk,
the guest does not have the upper directory and worker directory present.
Therefore, it is necessary to create these directories before mounting the filesystem with overlay.

Signed-off-by: ChengyuZhu6 <chengyu.zhu@intel.com>
2023-09-13 10:01:12 +08:00
ChengyuZhu6
72c9f62b70 agent: introduce DmVerityHandler to support dm-verity volume
We utilize the KataVirtualVolume which storing the dm-verity info
and the path of disk image on the host supplied by snapshotter as an integral part of `CreateContainer`.
Within this process, we copy the verity info and the disk image path to mount slice to create a block device by virtio-blk.
Then storing the `lowerdir` in rootfs.storage which is the mountpoint of the verity path through `CreateContainerRequest`.
To maintain clarity and avoid any need for modification to the `VirtioBlkPciHandler`,we introduce the `DmVerityHandler`.
This dedicated handler is responsible for calling image-rs to create verity device and mount the device to the `lowerdir` within the guest environment.

Signed-off-by: Jiang Liu <gerry@linux.alibaba.com>
Signed-off-by: ChengyuZhu6 <chengyu.zhu@intel.com>
2023-09-13 10:01:11 +08:00
ChengyuZhu6
fd33309475 image-builder: fix udev error when using docker to build image
Incorporate the `DM_VERITY` parameter when building the image with docker.

Fixes #7879

Signed-off-by: ChengyuZhu6 <chengyu.zhu@intel.com>
2023-09-13 09:34:22 +08:00
ChengyuZhu6
e36c2b6249 runtime: support to create VirtualVolume rootfs storages
1) Creating storage for each `extraoption` in rootFs.Options,
and then aggregates all storages  into `containerStorages`.
2) Creating storage for other data volumes and push them into `volumeStorages`.

Signed-off-by: ChengyuZhu6 <chengyu.zhu@intel.com>
2023-09-13 09:30:30 +08:00
ChengyuZhu6
5ad3eba8b1 runtime: redefine and add functions to handle VirtualVolume to storage
1) Extract function `handleBlockVolume` to create Storage only.
2) Add functions to handle KataVirtualVolume device and construct
   corresponding storages.

Signed-off-by: ChengyuZhu6 <chengyu.zhu@intel.com>
2023-09-13 09:30:30 +08:00
ChengyuZhu6
29eb2c02d9 runtime: extend SharedFile to support mutiple storage devices
To enhance the construction and administration of `Katavirtualvolume` storages,
this commit expands the 'sharedFile' structure to manage both
rootfs storages(`containerStorages`) including `Katavirtualvolume` and other data volumes storages(`volumeStorages`).

NOTE: `volumeStorages` is intended for future extensions to support Kubernetes data volumes.
Currently, `KataVirtualVolume` is exclusively employed for container rootfs, hence only `containerStorages` is actively utilized.

Signed-off-by: ChengyuZhu6 <chengyu.zhu@intel.com>
2023-09-13 09:30:30 +08:00
ChengyuZhu6
bedd536461 runtime: add functions to create devices in KataVirtualVolume
The snapshotter will place `KataVirtualVolume` information
into 'rootfs.options' and commence with the prefix 'io.katacontainers.volume='.
The purpose of this commit is to transform the encapsulated KataVirtualVolume data into device information.

Fixes #7792

Signed-off-by: ChengyuZhu6 <chengyu.zhu@intel.com>
Co-authored-by: Feng Wang <feng.wang@databricks.com>
Co-authored-by: Samuel Ortiz <sameo@linux.intel.com>
Co-authored-by: Wedson Almeida Filho <walmeida@microsoft.com>
2023-09-13 09:30:30 +08:00
ChengyuZhu6
d788d4af2f runtime: Add KataVirtualVolume struct in runtime
Add the corresponding data structure in the runtime part according to
kata-containers/kata-containers/pull/7698.

Signed-off-by: ChengyuZhu6 <chengyu.zhu@intel.com>
2023-09-13 09:30:30 +08:00
Steve Horsman
51c665a09c Merge pull request #7918 from stevenhorsman/CCv0-bump-to-rust-1.72
CCv0 bump to rust 1.72
2023-09-12 20:20:40 +01:00
stevenhorsman
36431de30f versions: Bump rust version
Bump rust to 1.72.0 to test what extra warnings/issues we get

Fixes: #7902
Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2023-09-12 15:16:50 +01:00
stevenhorsman
9ebb91f94c runk: Fix rust unecessary mut error
- Fix `error: variable does not need to be mutable`
in rust 1.72

Fixes: #7902
Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2023-09-12 15:16:50 +01:00
stevenhorsman
f7fd2c1dfc kata-ctl: useless-vec warning
- Fix clippy::useless-vec warning

Fixes: #7902
Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2023-09-12 15:16:50 +01:00
stevenhorsman
c0668ef7eb kata-ctl: Resolve non-minimal-cfg warning
- In rust 1.72, clippy warned clippy::non-minimal-cfg
as the cfg has only one condition, so doesn't
need to be wrapped in the any combinator.

Fixes: #7902
Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2023-09-12 15:16:50 +01:00
stevenhorsman
0a33d27c30 agent-ctl: Allow clippy lint
- Allow `clippy::redundant-closure-call`
which has issues with the guard function passed into
the `run_if_auto_values` macro

Fixes: #7902
Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2023-09-12 15:16:50 +01:00
stevenhorsman
48465d0547 runtime-rs: Fix useless-vec warning
Fix clippy::useless-vec warning

Fixes: #7902
Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2023-09-12 15:16:50 +01:00
stevenhorsman
cb7cc1d708 runtime-rs: Remove mut
Fix `error: variable does not need to be mutable`

Fixes: #7902
Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2023-09-12 15:16:50 +01:00
stevenhorsman
6e508ae322 dragonball: Allow ambiguous-glob-reexports
The bindgen generated code is triggering lots of
ambiguous-glob-reexports warnings in rust 1.70+

Fixes: #7902
Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2023-09-12 15:16:50 +01:00
stevenhorsman
91916ed118 dragonball: Resolve non-minimal-cfg warning
- In rust 1.72, clippy warned clippy::non-minimal-cfg
as the cfg has only one condition, so doesn't
need to be wrapped in the all combinators.

Fixes: #7902
Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2023-09-12 15:16:50 +01:00
stevenhorsman
d1d49675a0 agent: config: Allow clippy lint
- Allow `clippy::redundant-closure-call` in `from_cmdline`
which has issues with the guard function passed into
the `parse_cmdline_param` macro

Fixes: #7902
Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2023-09-12 15:16:50 +01:00
stevenhorsman
3416e104b8 agent: config: Fix useles-vec warning
Fix clippy::useless-vec warning

Fixes: #7902
Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2023-09-12 15:16:50 +01:00
stevenhorsman
495b9825e5 libs: Fix clippy unnecesary hashes error
- Fix error: unnecessary hashes around raw string literal

Fixes: #7902
Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2023-09-12 14:19:41 +01:00
stevenhorsman
da8d4a4584 agent: Vendor
run make vendor on agent to update

Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2023-09-12 12:54:54 +01:00
Yuan-Zhuo
03aceccb1b agent: optimize the code of systemd cgroup manager
1. Directly support CgroupManager::freeze through systemd API.
2. Avoid always passing unit_name by storing it into DBusClient.
3. Realize CgroupManager::destroy more accurately by killing systemd unit rather than stop it.
4. Ignore no such unit error when destroying systemd unit.
5. Update zbus version and corresponding interface file.

Acknowledgement: error handling for no such systemd unit error refers to

Fixes: #7080, #7142, #7143, #7166

Signed-off-by: Yuan-Zhuo <yuanzhuo0118@outlook.com>
Signed-off-by: Yohei Ueda <yohei@jp.ibm.com>
(cherry picked from commit 470d065415)
2023-09-12 12:01:40 +01:00
Fabiano Fidêncio
70e3dc5acb Merge pull request #7891 from fidencio/topic/CC-update-kernel-to-the-latest-lts-plus-bring-in-erofs-patches
CC | Update kernel to the latest LTS release (v6.1.52) and bring in erofs patches needed for the CC work
2023-09-11 16:31:00 +02:00
Fabiano Fidêncio
bbe0db55ac kernel: Add erofs patches needed for CC related work
All the patches have already been merged upstream and they've just been
cherry-picked to this branch.

Fixes: #7885

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
(cherry picked from commit fde34610cd)

 Conflicts:
	tools/packaging/kernel/kata_config_version
2023-09-11 13:21:21 +02:00
Fabiano Fidêncio
bea936b4a8 versions: Bump kernel to the latest LTS release (6.1.52)
We're bumping here in order to make our lives easier backporting EROFS
patches needed for the CC related work.

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
(cherry picked from commit dc6a4588a2)
2023-09-11 13:20:56 +02:00
Fabiano Fidêncio
3b212ec8ed Merge pull request #7883 from kata-containers/revert-7847-topic/CC-versions-update-kernel-to-6.4.14-stable
Revert "CC | versions: Bump to 6.4.14 stable kernel"
2023-09-11 12:24:44 +02:00
Fabiano Fidêncio
08b87a4eab Revert "CC | versions: Bump to 6.4.14 stable kernel" 2023-09-11 09:01:53 +02:00
Archana Shinde
911ab9c306 Merge pull request #7847 from fidencio/topic/CC-versions-update-kernel-to-6.4.14-stable
CC | versions: Bump to 6.4.14 stable kernel
2023-09-08 16:53:30 -07:00
Fabiano Fidêncio
d70ed93173 Merge pull request #7570 from LindaYu17/CCv0
CC | add sealed secret support in Kata
2023-09-07 09:46:33 +02:00
Biao Lu
13943fb81b agent: launch api-server-rest
If 'rest_api' is configured, start api-server-rest after
attestation-agent and confidential-data-hub.

Fixes: #7555

Signed-off-by: Biao Lu <biao.lu@intel.com>
2023-09-07 09:55:46 +08:00
Biao Lu
e865359f4e osbuilder: add api-server-rest in rootfs
Integrate api-server-rest into rootfs image.

Fixes: #7555

Signed-off-by: Biao Lu <biao.lu@intel.com>
2023-09-07 09:55:46 +08:00
Biao lu
47c28923d7 agent: Add config for api-server-rest
Add configuration for 'rest api server'.
Optional configurations are
  'agent.rest_api=attestation' will enable attestation api
  'agent.rest_api=resource' will enable resource api
  'agent.rest_api=all' will enable all (attestation and resource) api

Fixes: #7555

Signed-off-by: Biao lu <biao.lu@intel.com>
2023-09-07 09:55:46 +08:00
Linda Yu
212229df83 runtime: add sealed secret configuration
Fixes: #7555

Signed-off-by: Linda Yu <linda.yu@intel.com>
2023-09-07 09:55:46 +08:00
Linda Yu
f1573b4747 agent: unittest for sealed secret as file in kata
Fixes: #7555

Signed-off-by: Linda Yu <linda.yu@intel.com>
2023-09-07 09:55:46 +08:00
Linda Yu
d7873e5251 agent: support sealed secret as file in kata
Fixes: #7555

Signed-off-by: Linda Yu <linda.yu@intel.com>
2023-09-07 09:55:40 +08:00
Linda Yu
c60adedf99 agent: add feature for confidential data hub (cdh)
Fixes: #7555

Signed-off-by: Linda Yu <linda.yu@intel.com>
2023-09-07 09:00:25 +08:00
Linda Yu
9c02722d46 agent: unittest for sealed secret as env in kata
Fixes: #7555

Signed-off-by: Linda Yu <linda.yu@intel.com>
2023-09-07 09:00:25 +08:00
Linda Yu
75def881e5 agent: support sealed secret as env in kata
Fixes: #7555

Signed-off-by: Linda Yu <linda.yu@intel.com>
2023-09-07 09:00:25 +08:00
Biao Lu
5316839165 agent: launch confidential-data-hub
confidential-data-hub depends attestation-agent, and
confidential-data-hab need to start before rpc server, so move the
function 'init_attestation_agent' from image_rpc.rs to main.rs and
launch confidential-data-hub after 'init_attestation_agent'.

Fixes: #7544

Signed-off-by: Biao Lu <biao.lu@intel.com>
2023-09-07 08:59:31 +08:00
Fabiano Fidêncio
7cc29708a4 Merge pull request #7851 from BbolroC/hotfix-dockerbuild-s390x
CCv0: packaging: do not install docker-compose-plugin for s390x|ppc64le
2023-09-06 15:40:46 +02:00
Hyounggyu Choi
c3a8ce53e6 CCv0: packaging: do not install docker-compose-plugin for s390x|ppc64le
This PR is to skip installing docker-compose-plugin while buiding a `build-kata-deploy` image for s390x|ppc64le.
It is a temporary solution to fix current CI failures for s390x regarding `hash sum mismatch`.

Fixes: #7848
Signed-off-by: Hyounggyu Choi <Hyounggyu.Choi@ibm.com>
(cherry picked from commit 2efda20c77)
2023-09-06 13:16:16 +02:00
Fabiano Fidêncio
f64041e686 kernel: Add more configs to the whitelist
This is a partial backport of 8115a0522d,
which added those configs to the whitelist.

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2023-09-06 11:55:37 +02:00
Fabiano Fidêncio
57001431b4 versions: Bump to 6.4.14 stable kernel
This kernel update is needed in order to get the latest and greatest
commits related to EROFS, which will be used for allowing sharing the
container images between the guest and host for Confidential Containers
using the tarfs mode of EROFS.

We're removing a few options here, because:
* SECURITY_SELINUX_CHECKREQPROT_VALUE was deprecated as part of
  a7e4676e8e2c.
* CONFIG_IP_NF_TARGET_CLUSTERIP was removed as part of 9db5d918e2c0.
* CONFIG_NET_SCH_CBQ was removed as part of 051d44209842.

Fixes: #7845
Backports: #7846

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2023-09-06 11:03:31 +02:00
Biao Lu
b4092023bf osbuilder: add confidential-data-hub in rootfs
Fixes: #7544

Signed-off-by: Biao Lu <biao.lu@intel.com>
2023-09-06 10:57:34 +08:00
Biao Lu
acd0a75efd agent: rootfs: add sealed-secret in Makefile
When set SEALED_SECRET to "yes", the kata-agent is built with
sealed-secret capability, default value is "no".

Fixes: #7544

Signed-off-by: Biao Lu <biao.lu@intel.com>
2023-09-06 10:57:34 +08:00
Biao Lu
4e3a1ebcaf protocols: add support sealed_secret
To call CDH ttrpc API, 'unseal_secret' for 'sealed_secret', add
protocol file and generate ttrpc code.

Fixes: #7544

Signed-off-by: Biao Lu <biao.lu@intel.com>
2023-09-06 10:57:34 +08:00
Fabiano Fidêncio
83b020f4a3 Merge pull request #7826 from jiangliu/cherry2
CC | cherry-pick #7819 and #7821 from main branch
2023-09-03 00:33:56 +02:00