Commit Graph

5900 Commits

Author SHA1 Message Date
Peng Tao
c88820454d
Merge pull request #739 from jodh-intel/2.0-dev-containerd-install-docs
docs: Add containerd install guide
2020-10-13 11:48:56 +08:00
Peng Tao
16a6427ca9
Merge pull request #923 from liubin/fix/simplify-codes
agent: simplify codes
2020-10-13 09:54:46 +08:00
Eric Ernst
2e72972cd7
Merge pull request #910 from egernst/fix-parsing
agent: fix errorneous parsing for guest block size
2020-10-12 12:40:02 -07:00
Eric Ernst
f63f740545 agent: fix errorneous parsing for guest block size
We were assuming base 10 string before, when the block size from sysfs
is actually a hex string. Let's fix that.

Fixes: #908

Signed-off-by: Eric Ernst <eric.g.ernst@gmail.com>
2020-10-12 11:18:39 -07:00
James O. D. Hunt
43d70a32df docs: Add containerd install guide
Create a containerd installation guide and a new `kata-manager` script
for 2.0 that automated the steps outlined in the guide.

Also cleaned up and improved the installation documentation in various
ways, the most significant being:

- Added legacy install link for 1.x installs.
- Official packages section:
  - Removed "Contact" column (since it was empty!)
  - Reworded "Versions" column to clarify the versions are a minimum
    (to reduce maintenance burden).
  - Add a column to show which installation methods receive automatic updates.
  - Modified order of installation options in table and document to
    de-emphasise automatic installation and promote official packages
    and snap more.
- Removed sections no longer relevant for 2.0.

Fixes: #738.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2020-10-12 17:54:53 +01:00
Fupan Li
27634982f7
Merge pull request #915 from liubin/fix/914-use-macro-to-simplify-codes
agent: use macro to simplify parse_cmdline function in config.rs
2020-10-12 22:23:30 +08:00
bin liu
11c1ab8bca agent: use ok_or/map_err instead of match
Sometimes `Option.or_or` and `Result.map_err` may be simpler
than match statement. Especially in rpc.rs, there are
many `ctr.get_process` and `sandbox.get_container` which
are using `match`.

Signed-off-by: bin liu <bin@hyper.sh>
2020-10-12 16:59:02 +08:00
bin liu
6b9f99156e rustjail: use Iterator to manipulate vector elements
Use Iterator can save codes, and make code more readable

Signed-off-by: bin liu <bin@hyper.sh>
2020-10-12 14:26:33 +08:00
Ychau Wang
a7251651f8 docs: remove the 1.x version description about shim and proxy
Remove the build in shim and proxy desgin description from the
kata-api-design.md file.

Fixes: #912

Signed-off-by: Ychau Wang <wangyongchao.bj@inspur.com>
2020-10-12 14:11:18 +08:00
bin liu
dc1442c33a rustjail: delete codes commented out
There are some uses/codes/struct fields are commented out, and
may not turn into  un-comment these codes, so delete these comments.

Signed-off-by: bin liu <bin@hyper.sh>
2020-10-12 12:29:23 +08:00
bin liu
aa04111d9f rustjail: delete unused test code
The auto generated test code is no meanings, delete it.

Signed-off-by: bin liu <bin@hyper.sh>
2020-10-12 10:23:22 +08:00
Fupan Li
7470055cdc
Merge pull request #898 from bergwolf/arm-musl
fix arm CI
2020-10-12 10:03:45 +08:00
Bin Liu
490f030e2a
Merge pull request #917 from bergwolf/fix-cloud_hypervisor_repo
packaging: fix missing cloud_hypervisor_repo
2020-10-12 09:50:30 +08:00
Peng Tao
4f3206ac7e
Merge pull request #888 from liubin/881-add-crictl-examples
docs: Add crictl example json files
2020-10-11 12:07:18 +08:00
bin liu
eae685dc53 agent: use chain of Result to avoid early return
Use rust `Result`'s `or_else`/`and_then` can write clean codes.
And can avoid early return by check wether the `Result`
is `Ok` or `Err`.

Signed-off-by: bin liu <bin@hyper.sh>
2020-10-10 22:22:54 +08:00
bin liu
5e3d1fb60b agent: add blank lines between methods
In rpc.rs, there are no blank lines between methods, this commit
add blank lines for these methods.

Signed-off-by: bin liu <bin@hyper.sh>
2020-10-10 12:37:34 +00:00
bin liu
980e48ca94 agent: delete unused field in agentService
The code is for test, and not needed now.

Signed-off-by: bin liu <bin@hyper.sh>
2020-10-10 12:23:44 +00:00
bin liu
52b821fa5f agent: use no-named closure to reduce codes
For simple closures, inline closures can save codes.

Signed-off-by: bin liu <bin@hyper.sh>
2020-10-10 20:10:16 +08:00
Peng Tao
82e9450124 packaging: fix cloud-hypervisor binary path
1. ensure build-static-clh.sh puts cloud-hypervisor under ./cloud-hypervisor directory
2. install cloud-hypervisor/cloud-hypervisor binary

Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2020-10-10 20:10:03 +08:00
bin liu
b1f95e8d27 agent: use a local fn to reduce duplicated codes
The same codes used twices, aggregated into a function can
reduce codes.

Signed-off-by: bin liu <bin@hyper.sh>
2020-10-10 19:55:05 +08:00
Peng Tao
154a356ad4 packaging: apply qemu v5.1 stable fixes
Qemu v5.1 was released with an affending commit 9b3a35ec82
(virtio: verify that legacy support is not accidentally on).
As a result, it breaks commandline compatiblilities for old qemu
users. Upstream qemu has fixed it but no release has been put out yet.
Let's apply these fixes by hand for now.

Refs: https://www.mail-archive.com/qemu-devel@nongnu.org/msg729556.html

Depends-on: github.com/kata-containers/tests#2945
Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2020-10-10 18:29:23 +08:00
Jianyong Wu
c781a80820 agent: fix aarch64 build
aarch64 needs libgcc to resolve some non-builtin symbols.

Fixes: #909
Signed-off-by: Jianyong Wu <jianyong.wu@arm.com>
Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2020-10-10 18:29:23 +08:00
bin liu
906b38441c agent: update not accurate comments
This commit includes:
- update comments that not matched the function name
- file path with doubled slash

Fixes: #922

Signed-off-by: bin liu <bin@hyper.sh>
2020-10-10 17:57:13 +08:00
Peng Tao
78318c18f3 packaging: fix missing cloud_hypervisor_repo
It is needed in order to build from source.

Fixes: #916
Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2020-10-10 15:47:41 +08:00
bin liu
b7309943af agent: use macro to simplify parse_cmdline function in config.rs
In function parse_cmdline there are some similar codes, if we want
to add more commandline arguments, the code will grow too long.
Use macro can reduce some codes with the same logic/processing.

Fixes: #914

Signed-off-by: bin liu <bin@hyper.sh>
2020-10-10 15:20:47 +08:00
bin liu
9834a766aa docs: add namespace key to pod/container config files
If no namespace field in config files, CRI-O will failed:
 setting pod sandbox name and id: cannot generate pod name without namespace

Signed-off-by: bin liu <bin@hyper.sh>
2020-10-10 10:02:08 +08:00
Julio Montes
291257c0df
Merge pull request #897 from devimc/2020-10-09/snapCI
ci: snap: add event filtering
2020-10-09 15:28:57 -05:00
Julio Montes
37e7de72a5 ci: snap: add event filtering
Run the snap CI on every PR is not needed. Don't run the snap CI
on PRs that don't change the source code (*.go/*.rs), a configuration
file or Makefile.

fixes #896

Signed-off-by: Julio Montes <julio.montes@intel.com>
2020-10-09 09:48:28 -05:00
Julio Montes
4f0fe8473b
Merge pull request #886 from bergwolf/CVE-2019-19921
agent: do not follow link when mounting container proc and sysfs
2020-10-09 09:47:30 -05:00
bin liu
9a02e6eb88 docs: Add crictl example json files
Add basic sample pod/container config files to show
how to use `crictl` with Kata containers.

Fixes: #881

Signed-off-by: bin liu <bin@hyper.sh>
2020-10-09 21:03:22 +08:00
Bin Liu
fd7d0ef999
Merge pull request #884 from bergwolf/cargo-lock
agent-ctl: include cargo lock updates
2020-10-09 20:23:19 +08:00
Fupan Li
3a659a6733
Merge pull request #891 from bergwolf/CVE-2016-9962
agent: set init process non-dumpable
2020-10-09 19:03:24 +08:00
Peng Tao
b7147edadb agent: do not follow link when mounting container proc and sysfs
Attackers might use it to explore other containers in the same pod.
While it is still safe to allow it, we can just close the race window
like runc does.

Fixes: #885
Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2020-10-09 18:54:26 +08:00
Bin Liu
43da14e7b3
Merge pull request #752 from YchauWang/clear-moke-code01
runtime: Clear the VCMock 1.x API Methods from 2.0
2020-10-09 17:41:21 +08:00
Peng Tao
15b7156348 agent: set init process non-dumpable
On old kernels (like v4.9), kernel applies CLOECEC in wrong order w.r.t.
dumpable task flags. As a result, we might leak guest file descriptor to
containers. This is a former runc CVE-2016-9962 and still applies to
kata agent. Although Kata container is still valid at protecting the
host, we should not leak extra resources to user containers.

This sets the init processes that join and setup the container's
namespaces as non-dumpable before they setns to the container's pid (or
any other ) namespace.

This settings is automatically reset to the default after the Exec in
the container so that it does not change functionality for the
applications that are running inside, just our init processes.

This prevents parent processes, the pid 1 of the container, to ptrace
the init process before it drops caps and other sets LSMs.

The order during the exec syscall is that the process is set back to
dumpable before O_CLOEXEC are processed.

Refs:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=613cc2b6f272c1a8ad33aefa21cad77af23139f7
https://github.com/torvalds/linux/blob/v4.9/fs/exec.c#L1290-L1318
opencontainers/runc@50a19c6
https://nvd.nist.gov/vuln/detail/CVE-2016-9962

Fixes: #890
Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2020-10-09 17:12:06 +08:00
Peng Tao
3f8e619c2f
Merge pull request #876 from jcvenegas/dax-off
virtiofs: Disable DAX
2020-10-09 13:39:42 +08:00
Peng Tao
83d80872cc
Merge pull request #546 from amshinde/2.0-agent-debug
docs: Update docs for enabling agent debug console
2020-10-09 10:54:54 +08:00
Peng Tao
00ad3fd308 agent-ctl: include cargo lock updates
Simply running `make` would generate some cargo lock updates for
agent-ctl. Let's include them so that we have fixed dependencies.

Fixes: #883
Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2020-10-09 10:50:45 +08:00
Peng Tao
367e436ff8
Merge pull request #795 from c3d/bug/750-warnings
Remove compilation warnings
2020-10-09 10:26:08 +08:00
Peng Tao
a82237a810
Merge pull request #874 from rhafer/fix-873
osbuilder: Create target directory for agent
2020-10-09 10:22:55 +08:00
Julio Montes
441026b877
Merge pull request #880 from devimc/2020-10-08/versions/sriov-network-device-plugin
versions: add plugins section
2020-10-08 14:47:10 -05:00
Julio Montes
8cd62d7bdd versions: add plugins section
plugins sections contains the details of plugins required for
the components or testing.

Add sriov-network-device-plugin url and version that are consumed
by the VFIO test in the tests repository.

fixes #879

Signed-off-by: Julio Montes <julio.montes@intel.com>
2020-10-08 13:01:01 -05:00
Julio Montes
2712e31c3e
Merge pull request #878 from devimc/2020-10-01/snapCI
snap: specify python version
2020-10-08 12:59:19 -05:00
Jose Carlos Venegas Munoz
c4472481bc virtiofs: Disable DAX
virtiofs DAX support is not stable today, there are
a few corner cases to make it default.

Fixes: #862
Fixes: #875

Signed-off-by: Jose Carlos Venegas Munoz <jose.carlos.venegas.munoz@intel.com>
2020-10-08 10:59:10 -05:00
Julio Montes
3e56de8101 snap: specify python version
In order to avoid `unmet dependencies` error in the CI,
the python version must be specified in the yaml.

fixes #877

Signed-off-by: Julio Montes <julio.montes@intel.com>
2020-10-08 10:53:20 -05:00
Ralf Haferkamp
e3cdc89b6c osbuilder: Create target directory for agent
When building with AGENT_SOURCE_BIN pointing to an already built
kata-agent binary, the target directory needs to be created in the
rootfs tree.

Fixes #873

Signed-off-by: Ralf Haferkamp <rhafer@suse.com>
2020-10-08 17:07:40 +02:00
Bo Chen
b9205cae1c
Merge pull request #870 from egernst/fixup
packaging: fix image build script
2020-10-07 13:25:13 -07:00
Eric Ernst
7cad865d13 packaging: fix image build script
There were a couple of issues with the build-scripts discovered while
doing release:
 - Relative paths are error prone. Fix error.
 - short_commit_length is used to truncate sha for commits when
 appending agent version to resulting files. Before this was
 in pkglib.sh, which is otherwise an unused file from when we
 supported OBS. Add this define to lib.sh, which is sourced by
 the applicable packaging scripts.

There's plenty of room for improvement, but these fixes make the
existing scripts functional again.

Fixes: #871

Signed-off-by: Eric Ernst <eric.g.ernst@gmail.com>
2020-10-07 09:09:31 -07:00
Christophe de Dinechin
0e898c6bc4 rust-agent: Treat warnings as error
Avoid the accumulation of warnings we had, as reported in #750.

Fixes: #750

Signed-off-by: Christophe de Dinechin <dinechin@redhat.com>
2020-10-07 17:30:21 +02:00
Christophe de Dinechin
0e4baaabcc rust-agent: Identify unused results in tests
Assign unused results to _ in order to silence warnings.

This addresses the following warnings:

    warning: unused `std::result::Result` that must be used
        --> rustjail/src/mount.rs:1182:16
         |
    1182 |         defer!(unistd::chdir(&olddir););
         |                ^^^^^^^^^^^^^^^^^^^^^^^
         |
         = note: `#[warn(unused_must_use)]` on by default
         = note: this `Result` may be an `Err` variant, which should be handled

    warning: unused `std::result::Result` that must be used
        --> rustjail/src/mount.rs:1183:9
         |
    1183 |         unistd::chdir(tempdir.path());
         |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         |
         = note: this `Result` may be an `Err` variant, which should be handled

While in regular code, we want to log possible errors, in test code
it's OK to simply ignore the returned value.

Fixes: #750

Signed-off-by: Christophe de Dinechin <dinechin@redhat.com>
2020-10-07 17:30:13 +02:00