Commit Graph

8293 Commits

Author SHA1 Message Date
Fabiano Fidêncio
e8bc26f90d clh: introduce setupVirtiofsDaemon()
Similarly to what's been done with the `createVirtiofsDaemon`, let's
create a `setupVirtiofsDaemon` one.

It will also become handy later in this series.

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2022-03-03 12:48:14 +01:00
Fabiano Fidêncio
413b3b477a clh: introduce createVirtiofsDaemon()
Let's introduce and use a new `createVirtiofsDaemon` method.  Its name
says it all, and it'll be handy later in this series when, spoiler
alert, SharedFS cannot be used (in such cases as in Confidential
Guests).

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2022-03-03 12:48:02 +01:00
Fabiano Fidêncio
76e4f6a2a3 Revert "hypervisors: Confidential Guests do not support Device hotplug"
This reverts commit df8ffecde0, as device
hotplug *is* supported and, more than that, is very much needed when
using virtio-blk instead of virtio-fs.

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2022-03-03 09:59:55 +01:00
Julio Montes
934788eb53
Merge pull request #3812 from fidencio/wip/disable-clh-build-on-ppc64le
snap: Don't build cloud-hypevisor on ppc64le
2022-03-02 15:40:01 -06:00
Fabiano Fidêncio
c1fb4bb726 snap: Don't build cloud-hypevisor on ppc64le
snapcraft build is failing due to:
 ``
utils.mk:130: "WARNING: powerpc64le-unknown-linux-musl target is unavailable"
```

It seems to happen as powerpc64-unknown-linux-musl is a target that
although there's support for it, it's not exactly built or
automatically tested, at least according to:
https://doc.rust-lang.org/rustc/platform-support.html

Fixes: #3803

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2022-03-02 19:04:30 +01:00
Bin Liu
2ae8bd696a
Merge pull request #3367 from wfly1998/main
build: always reset ARCH after getting it
2022-03-02 14:42:45 +08:00
Bin Liu
75877f8793
Merge pull request #3187 from Kvasscn/kata_dev_remove_temp_vsock_dir
virtcontainers: remove temp dir created for vsock in test code
2022-03-02 11:05:47 +08:00
Chelsea Mafrica
c49e261819
Merge pull request #3782 from jodh-intel/docs-add-ut-presentation
docs: Add unit testing presentation
2022-03-01 11:03:54 -08:00
James O. D. Hunt
b27c7f4068 docs: Add unit testing presentation
Add the Kata Containers unit testing presentation I gave to the Kata
outreach students as this may be of some use to others.

Fixes: #3781

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2022-03-01 15:52:03 +00:00
Francesco Giudici
7f638dd049
Merge pull request #3764 from Jakob-Naucke/hugepages-test-s390x
virtcontainers: Use available s390x hugepages
2022-03-01 14:33:59 +01:00
Fabiano Fidêncio
01c57da84b
Merge pull request #3552 from goodluckbot/update-hypervisor-version
Update QEMU >= 6.1.0 in configure-hypervisor.sh
2022-03-01 14:19:16 +01:00
Fabiano Fidêncio
4ab35b0899
Merge pull request #3796 from jodh-intel/fix-monitor-listen-address
Fix monitor listen address
2022-03-01 13:51:01 +01:00
Fabiano Fidêncio
8d4412d89f
Merge pull request #3728 from fidencio/wip/snapcraft-update-clh-installation
snap: clh: Re-use kata-deploy script here
2022-03-01 13:07:13 +01:00
Fabiano Fidêncio
6c2cc1fbd1
Merge pull request #3341 from Jakob-Naucke/centos-stream
osbuilder: Add CentOS Stream rootfs
2022-03-01 12:20:22 +01:00
Fabiano Fidêncio
97c17085b0
Merge pull request #3770 from Jakob-Naucke/gofmt-vmm-s390x
runtime: Gofmt fixes
2022-03-01 11:34:15 +01:00
James O. D. Hunt
e64c54a2ad monitor: Listen to localhost only by default
Change `kata-monitor` to listen to port `8090` on the local interface
only by default.

> **Note:**
>
> This is a breaking change as previously it listened on all interfaces.

Fixes: #3795.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2022-03-01 10:00:43 +00:00
James O. D. Hunt
e6350d3d45 monitor: Fix build options
Removed redundant and duplicated build options to build
`kata-monitor` the same way as the other components:

- `CGO_ENABLED=0` is not necessary.
- `-buildmode=exe` is not necessary since `BUILDFLAGS` already sets the
  build mode.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2022-03-01 10:00:43 +00:00
Fabiano Fidêncio
a67b93bb03 snap: clh: Re-use kata-deploy script here
The current snap build for clh is broken as it's not aware of how to
build the binary from sources.

Instead of fixing it here, let's take advantage of the kata-deploy
script, which is capable of building from sources, and re-use it here.

Fixes: #3693

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2022-03-01 09:03:51 +01:00
Fabiano Fidêncio
f31125fe92 version: Bump cloud-hypervisor to b0324f85571c441f
This bump brings a fix on the build script, for ARM, so we can use the
very same build script everywhere.

The commit of our interest is b0324f85571c441f840e9bdeb25410514a00bb74:
```
scripts: Fix musl build on aarch64

Adding the missing TARGET_CC environment variable to get the build to
complete correctly.

Fixes #3776

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2022-03-01 09:03:51 +01:00
GabyCT
ccb063b848
Merge pull request #3788 from fidencio/wip/update-clh-confidential-guest-comments
Update `confidential_guest` comments
2022-02-28 15:11:01 -06:00
GabyCT
bc1733bb0e
Merge pull request #3774 from egernst/delinux-runtime
cleanup runtime pkgs for Darwin build, add basic Darwin build/unit test
2022-02-28 15:08:09 -06:00
GabyCT
506ad6f6e7
Merge pull request #3792 from GabyCT/topic/updateread
docs: Update Readme document
2022-02-28 14:16:43 -06:00
goodluckbot
54d0a672c5 subsystem: build
With the ACPI PCI hotplug changes introduced in 2.3, QEMU >= 6.1 is required.
Remove unnecessary qemu version check in build script.

Fixes #3547

Signed-off-by: goodluckbot <tangbo_gl@hotmail.com>
2022-03-01 01:18:35 +08:00
Fabiano Fidêncio
21a8ba93c5
Merge pull request #3784 from liubin/fix/3783-use-exec-pipe
runtime: use Cmd.StdoutPipe instead of self-created pipe
2022-02-28 18:04:58 +01:00
Gabriela Cervantes
edf20766d1 docs: Update Readme document
This PR updates the README document by using the proper link for
the contributing guide as well as a misspelling.

Fixes #3791

Signed-off-by: Gabriela Cervantes <gabriela.cervantes.tellez@intel.com>
2022-02-28 16:52:26 +00:00
Jakob Naucke
eda8ea154a
runtime: Gofmt fixes
- Mostly blank lines after `+build` -- see
  https://pkg.go.dev/go/build@go1.14.15 -- this is, to date, enforced by
  `gofmt`.
- 1.17-style go:build directives are also added.
- Spaces in govmm/vmm_s390x.go

Fixes: #3769
Signed-off-by: Jakob Naucke <jakob.naucke@ibm.com>
2022-02-28 17:24:47 +01:00
Eric Ernst
4afb278fe2 ci: add github action to exercise darwin build, unit tests
There are a few outstanding changes required to build the runtime on
Darwin.

Let's add a GitHub action to exercise build and unit tests of the
packages which we do expect to work. Eventually this should be dropped
and we can run any Darwin specific tests, or just add MacOS to the
matrix for our static check OSes.

Fixes: #3778

Signed-off-by: Eric Ernst <eric_ernst@apple.com>
2022-02-28 08:01:53 -08:00
Eric Ernst
e355a71860 container: file is not linux specific
This should not be linux specific -- drop restriction.

Signed-off-by: Eric Ernst <eric_ernst@apple.com>
2022-02-28 08:01:53 -08:00
Eric Ernst
b31876eefb device-manager: move linux-only test to a linux-only file
We can't Mkdev on Darwin - let's make sure the vfio test is in a
linux-only file.

Signed-off-by: Eric Ernst <eric_ernst@apple.com>
2022-02-28 08:01:53 -08:00
Eric Ernst
6a5c634490 resourcecontrol: SystemdCgroup check is not necessarily linux specific
This utility function is also used to check the spec that will run in
the guest - no need for this to be linux specific.

Signed-off-by: Eric Ernst <eric_ernst@apple.com>
2022-02-28 08:01:53 -08:00
Eric Ernst
cc58cf6993 resourcecontrol: convert stats dev_t to unit64types
Their types may differ on various host OSes, but
unix.Major|Minor always takes a uint64

Depends-on: github.com/kata-containers/tests#4516
Signed-off-by: Eric Ernst <eric_ernst@apple.com>
2022-02-28 08:01:53 -08:00
Eric Ernst
5be188cc29 utils: Add darwin stub
Add a stub for utils_darwin to facilitate building this package on
Darwin. We can probably drop this empty stub if we have better
abstraction for the various parts of virtcontainers that call it
today...

Fixes:# 3777

Signed-off-by: Eric Ernst <eric_ernst@apple.com>
2022-02-28 08:01:53 -08:00
Samuel Ortiz
ad0449195d virtcontainers: Convert stats dev_t to uint64
We need to convert them to uint64 as their types may differ on various
host OSes, but unix.Major|Minor takes a uint64 regardless.

Signed-off-by: Samuel Ortiz <s.ortiz@apple.com>
2022-02-28 08:01:53 -08:00
Samuel Ortiz
56751089c0 katautils: Use a syscall wrapper for the hook JSON state
There is no real equivalent of a thread ID on Darwin.

Signed-off-by: Samuel Ortiz <s.ortiz@apple.com>
2022-02-28 08:01:53 -08:00
Samuel Ortiz
7d64ae7a41 runtime: Add a syscall wrapper package
It allows to support syscall variations between host OSes.

Signed-off-by: Samuel Ortiz <s.ortiz@apple.com>
2022-02-28 08:01:53 -08:00
Samuel Ortiz
abc681ca5f katautils: Add Darwin stub for the netNS API
And move the current implementation into a Linux only file.

Signed-off-by: Samuel Ortiz <s.ortiz@apple.com>
2022-02-28 08:01:53 -08:00
Fabiano Fidêncio
9e3353a7e4
Merge pull request #3732 from YchauWang/wyc-docs-developer
docs: Developer-Guide build a custom Kata agent with musl
2022-02-28 12:14:39 +01:00
Fabiano Fidêncio
de57466212 config: Expand confidential_guest comments
Let's clarify that an error will be reported in case confidential_guest
is enabled, but the hardware where Kata Containers is running doesn't
provide the required feature set.

Fixes: #3787

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2022-02-28 11:57:42 +01:00
Fabiano Fidêncio
641d475fa6 config: clh: Use "Intel TDX" instead of just "TDX"
Let's use "Intel TDX" rather than just "TDX", as it can ease the
understanding of the terminology.

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2022-02-28 10:27:21 +01:00
Fabiano Fidêncio
0bafa2def9 config: clh: Mention supported TEEs
Let's mention the supported TEEs to be used with confidential guests.

Right now, Cloud Hyperisor supports only Intel TDX, used together with
TD Shim.

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2022-02-28 10:24:33 +01:00
bin
81ed269ed2 runtime: use Cmd.StdoutPipe instead of self-created pipe
Nydusd uses a bufio.Scanner to check if nydusd process has
existed, but stderr/stdout passed to Cmd is self-created pipe,
this pipe will not be closed if the process start failing.

Use standard Cmd.StdoutPipe can close the stdout and kata shim
will detect the existence of the nydusd process, then call cmd.Wait to
reap the process' resources.

Fixes: #3783

Signed-off-by: bin <bin@hyper.sh>
2022-02-28 16:52:49 +08:00
Bin Liu
441fdbaf9f
Merge pull request #3753 from sailorvii/main
kata-agent: Fix mismatching error of cgroup and mountinfo.
2022-02-28 16:07:26 +08:00
sailorvii
8edca8bbd1 kata-agent: Fix mismatching error of cgroup and mountinfo.
The content about systemd in "/proc/self/cgroup" is as:
1:name=systemd:/kubepods/pod1815643d-3789-4e4e-aaf4-00de024912e1/0e15a65bd5f7b30a0b818d90706212354d8b3f0998a1495473c3be9a24706ccf

and in "/prol/self/mountinfo" is as:
30 29 0:26 / /sys/fs/cgroup/systemd rw,nosuid,nodev,noexec,relatime shared:6 - cgroup cgroup rw,xattr,release_agent=/usr/lib/systemd/systemd-cgroups-agent,name=systemd

The keys extracted from the two files are the same as "name=systemd". So no need to rename the key to "systemd".

Fixes: #3385

Signed-off-by: sailorvii <challengingway@hotmail.com>
2022-02-28 10:03:09 +08:00
Eric Ernst
3997c962c2
Merge pull request #3767 from tanweernoor/02242022-kata-containers-issue-3631
runtime, config: make selinux configurable
2022-02-26 08:44:29 -08:00
Eric Ernst
08976b591b
Merge pull request #3776 from fidencio/wip/fix-unbound-variable-tools-clh
Fix unbound variable / typo on error mesage
2022-02-25 15:49:08 -08:00
Fabiano Fidêncio
a9ba7c132b clh: Fix typo on HotplugRemoveDevice
A copy and paste mistake was made and the error on HotplugRemoveDevice()
should be about removal and not about addition.

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2022-02-25 22:35:32 +01:00
Fabiano Fidêncio
827ab82a82 tools: clh: Fix unbound variable
4c164afbac renamed extra_build_args to
features, but did it only in one place, leading to:
```
21:15:28 /home/jenkins/workspace/kata-containers-2.0-ubuntu-ARM-PR/go/src/github.com/kata-containers/kata-containers/tools/packaging/static-build/cloud-hypervisor/build-static-clh.sh: line 55: features: unbound variable
21:15:29 make[1]: *** [tools/packaging/kata-deploy/local-build/Makefile:30: cloud-hypervisor-tarball-build] Error 1
```

Fixes: #3775

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2022-02-25 22:35:25 +01:00
Tanweer Noor
082d538cb4 runtime: make selinux configurable
removes --tags selinux handling in the makefile (part of it introduced here: d78ffd6)
and makes selinux configurable via configuration.toml

Fixes: #3631
Signed-off-by: Tanweer Noor <tnoor@apple.com>
2022-02-25 10:33:46 -08:00
Fabiano Fidêncio
ea1876f057
Merge pull request #3771 from fidencio/wip/clh-tdx
clh: Add TDX support
2022-02-25 18:45:31 +01:00
Samuel Ortiz
1103f5a4d4 virtcontainers: Use FilesystemSharer for sharing the containers files
Switching to the generic FilesystemSharer brings 2 majors improvements:

1. Remove container and sandbox specific code from kata_agent.go
2. Allow for non Linux implementations to provide ways to share
   container files and root filesystems with the Kata Linux guest.

Fixes #3622

Signed-off-by: Samuel Ortiz <s.ortiz@apple.com>
2022-02-25 17:22:27 +01:00