Commit Graph

534 Commits

Author SHA1 Message Date
Christophe de Dinechin
4e89b885d2 config: Protect file_mem_backend against annotation attacks
This one could theoretically be used to overwrite data on the host.
It seems somewhat less risky than the earlier ones for a number
of reasons, but worth protecting a little anyway.

Fixes: #901

Signed-off-by: Christophe de Dinechin <dinechin@redhat.com>
2020-10-14 16:10:12 +02:00
Christophe de Dinechin
aae9656d8b config: Protect vhost_user_store_path against annotation attacks
This path could be used to overwrite data on the host.

Fixes: #901

Signed-off-by: Christophe de Dinechin <dinechin@redhat.com>
2020-10-14 16:10:12 +02:00
Christophe de Dinechin
b21a829c61 config: Protect ctlpath from annotation attack
This also adds annotation for ctlpath which were not present
before. It's better to implement the code consistenly right now to make
sure that we don't end up with a leaky implementation tacked on later.

Fixes: #901

Signed-off-by: Christophe de Dinechin <dinechin@redhat.com>
2020-10-14 16:10:12 +02:00
Christophe de Dinechin
27b6620b23 config: Protect jailer_path annotation
The jailer_path annotation can be used to execute arbitrary code on
the host. Add a jailer_path_list configuration entry providing a list
of regular expressions that can be used to filter annotations that
represent valid file names.

Fixes: #901

Signed-off-by: Christophe de Dinechin <dinechin@redhat.com>
2020-10-14 16:10:12 +02:00
Christophe de Dinechin
bf13ff0a3a config: Protect virtio_fs_daemon annotation
Sending the virtio_fs_daemon annotation can be used to execute
arbitrary code on the host. In order to prevent this, restrict the
values of the annotation to a list provided by the configuration
file.

Fixes: #901

Signed-off-by: Christophe de Dinechin <dinechin@redhat.com>
2020-10-14 16:10:12 +02:00
Christophe de Dinechin
8c75de1966 config: Add 'List' alternates for hypervisor configuration paths
Paths mentioned in the hypervisor configuration can be overriden
using annotations, which is potentially dangerous. For each path,
add a 'List' variant that specifies the list of acceptable values
from annotations.

Bug: https://bugs.launchpad.net/katacontainers.io/+bug/1878234

Fixes: #901

Signed-off-by: Christophe de Dinechin <dinechin@redhat.com>
2020-10-14 16:10:12 +02:00
Julio Montes
6df165c19d runtime: add support for SGX
Support the `sgx.intel.com/epc` annotation that is defined by the intel
k8s plugin. This annotation enables SGX. Hardware-based isolation and
memory encryption.

For example, use `sgx.intel.com/epc = "64Mi"` to create a container
with 1 EPC section with pre-allocated memory.

At the time of writing this patch, SGX patches have not landed on the
linux kernel project.
The following github kernel fork contains all the SGX patches for the
host and guest: https://github.com/intel/kvm-sgx

fixes #483

Signed-off-by: Julio Montes <julio.montes@intel.com>
2020-10-01 08:24:29 -05:00
bin liu
484a595f1a runtime: add enable_debug_console configuration item for agent
Set enable_debug_console=true in Kata's congiguration file,
runtime will pass `agent.debug_console`
and `agent.debug_console_vport=1026` to agent.

Fixes: #245

Signed-off-by: bin liu <bin@hyper.sh>
2020-09-27 15:04:59 +08:00
bin liu
febdf8f68c runtime: add debug console service
Add `kata-runtime exec` to enter guest OS
through shell started by agent

Fixes: #245

Signed-off-by: bin liu <bin@hyper.sh>
2020-09-27 10:57:17 +08:00
Qi Feng Huo
f5598a1bc2 Subject: [PATCH] qemu: add annotations for iommu_platform
for s390x virtio devices

Add iommu_platform annotations for qemu for ccw,
other supported devices can also make use of that.

  Fixes #603

Signed-off-by: Qi Feng Huo <huoqif@cn.ibm.com>
2020-08-28 11:25:14 +08:00
Penny Zheng
1099a28830 kata 2.0: delete use_vsock option and proxy abstraction
With kata containers moving to 2.0, (hybrid-)vsock will be the only
way to directly communicate between host and agent.
And kata-proxy as additional component to handle the multiplexing on
serial port is also no longer needed.
Cleaning up related unit tests, and also add another mock socket type
`MockHybridVSock` to deal with ttrpc-based hybrid-vsock mock server.

Fixes: #389

Signed-off-by: Penny Zheng penny.zheng@arm.com
2020-07-16 04:20:02 +00:00
Peng Tao
2bff7a16f5
Merge pull request #363 from liubin/feature/delete-sub-commands-332
runtime: delete unused sub-commands.
2020-07-13 11:06:27 +08:00
bin liu
bbf8517050 runtime: add pprof interface for shim
Add new http interfaces to support pprof:

- /sandboxes
- /debug/vars
- /debug/pprof/
- /debug/pprof/cmdline
- /debug/pprof/profile
- /debug/pprof/symbol
- /debug/pprof/trace

Fixes: #397

Signed-off-by: bin liu <bin@hyper.sh>
2020-07-10 13:05:25 +08:00
bin liu
3cf8b470cd runtime: delete Stateful from SandboxConfig
Since all containers are started from shim v2, `Stateful` is not needed.

Fixes: #332

Signed-off-by: bin liu <bin@hyper.sh>
2020-07-08 21:59:44 +08:00
bin liu
069505e2d5 runtime: delete unused sub-commands.
This PR delete codes not used anymore.

Fixes: #332

Signed-off-by: bin liu <bin@hyper.sh>
2020-07-08 21:59:03 +08:00
Hui Zhu
e3a3818f7a
Merge pull request #388 from lifupan/2.0-dev
config: there is no need to check vhost-vosck for FC
2020-07-08 20:58:14 +08:00
bin liu
bd8f03a5ef runtime: remove agent abstraction
This PR will delete agent abstraction and use Kata agent as the only one agent.

Fixes: #377

Signed-off-by: bin liu <bin@hyper.sh>
2020-07-08 10:07:40 +08:00
Fupan Li
92697a197f
Merge pull request #297 from liubin/2-dev/metrics
Kata 2.0: add metrics for agent/guest/shim
2020-07-08 09:44:20 +08:00
Fupan Li
57dfda9b3d
Merge pull request #365 from liubin/feature/delete-shim-364
runtime: clean up shim abstraction
2020-07-07 09:54:27 +08:00
fupan.lfp
83b2366560 config: there is no need to check vhost-vosck for FC
Since the FC used the hybrid vsock, there's no need
to check whether the vhost vsock suported by host.

Fixes: #387

Signed-off-by: fupan.lfp <fupan.lfp@antfin.com>
2020-07-06 16:02:37 +08:00
bin liu
1b75daa00f runtime: add new command to collect metrics from Kata containers
Add a new command to collect metrics and return metrics to Prometheus.

Signed-off-by: bin liu <bin@hyper.sh>
2020-07-02 17:54:54 +08:00
bin liu
186fed2a11 runtime: add implementation of GetMetrics
add implementation of `GetMetrics` for runtime.

Signed-off-by: bin liu <bin@hyper.sh>
2020-07-02 10:58:14 +08:00
Jose Carlos Venegas Munoz
94fdec4e4b clh: Allow add virtiofs args and cache options from config
[ port from runtime commit e5a3211c74e20e9878fd0f5d1c80a3c4354eabd1 ]

Today some options for virtiofsd could improve compatibility
for example xattrs for dnf or cache=auto for file consistency
for changes in the host. Allow users can enabled as requiered.

Signed-off-by: Jose Carlos Venegas Munoz <jose.carlos.venegas.munoz@intel.com>
Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2020-06-30 04:04:39 -07:00
bin liu
3ece4130c9 runtime: clean up shim abstraction
This PR will delete shim abstraction from sandbox.

Fixes: #364

Signed-off-by: bin liu <bin@hyper.sh>
2020-06-30 15:52:20 +08:00
Jia He
fa9d619e8a qemu: add cpu_features option
[ port from runtime commit 0100af18a2afdd6dfcc95129ec6237ba4915b3e5 ]

To control whether guest can enable/disable some CPU features. E.g. pmu=off,
vmx=off. As discussed in the thread [1], the best approach is to let users
specify them. How about adding a new option in the configuration file.

Currently this patch only supports this option in qemu,no other vmm.

[1] https://github.com/kata-containers/runtime/pull/2559#issuecomment-603998256

Signed-off-by: Jia He <justin.he@arm.com>
Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2020-06-29 20:16:11 -07:00
Liam Merwick
d3b3e8bee6 virtcontainers: x86: Support microvm machine type
[ port from runtime commit 6aff077901021d9a0075c446dfe281b2487e1487 ]

With the addition of support to govmm for multiple transports (intel/govmm#111)
and microvm (intel/govmm#121) we can now enable support for the 'microvm'
machine type in kata-runtime.

Signed-off-by: Liam Merwick <liam.merwick@oracle.com>
Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2020-06-29 01:06:30 -07:00
Peng Tao
3bbb97add3
Merge pull request #312 from Pennyzct/network_throttle_on_qemu
rate-limiter: network I/O throttling on VM level
2020-06-25 04:59:44 +08:00
Penny Zheng
527c3f4634 test: Add unit test TestNewFirecrackerHypervisor
We have defined specific config file configuration-fc.toml for firecracker,
including specific features and requirements, but the related unit test
TestNewFirecrackerHypervisor is missing.

Fixes: #250

Signed-off-by: Penny Zheng <penny.zheng@arm.com>
2020-06-24 06:14:42 +00:00
Penny Zheng
c2645f5d5a rate-limiter: add rate limiter configuration/annotation on VM level
Add configuration/annotation about network I/O throttling on VM level.
rx_rate_limiter_max_rate is dedicated to control network inbound
bandwidth per pod.
tx_rate_limiter_max_rate is dedicated to control network outbound
bandwidth per pod.

Fixes: #250

Signed-off-by: Penny Zheng <penny.zheng@arm.com>
2020-06-24 06:14:04 +00:00
Christophe de Dinechin
042426d73a katatestutils: Use the configured virtiofs daemon path
The current path is hardcoded as follows:
  virtio_fs_daemon = "/path/to/virtiofsd"

Switch to using the value of config.VirtioFSDaemon instead.

Fixes: #2686

Signed-off-by: Christophe de Dinechin <dinechin@redhat.com>
Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2020-06-23 22:10:44 +02:00
Adrian Moreno
b97287090b qemu: enable iommu on q35
Add a configuration option and a Pod Annotation

If activated:
- Add kernel parameters to load iommu
- Add irqchip=split in the kvm options
- Add a vIOMMU to the VM

Fixes #2694
Signed-off-by: Adrian Moreno <amorenoz@redhat.com>
Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2020-06-22 16:37:20 +02:00
Peng Tao
4fdb4cffd5 runtime: update vendor/modules.txt
go 1.14 requires it to match go.mod and exposes a backtrace with
slightly difference.

Fixes: #227
Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2020-05-25 23:30:42 -07:00
Peng Tao
6de95bf36c gomod: update runtime import path
To use the kata-containers repo path.

Most of the change is generated by script:
find . -type f -name "*.go" |xargs sed -i -e \
's|github.com/kata-containers/runtime|github.com/kata-containers/kata-containers/src/runtime|g'

Fixes: #201
Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2020-04-29 18:39:03 -07:00
Peng Tao
a02a8bda66 runtime: move all code to src/runtime
To prepare for merging into kata-containers repository.

Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2020-04-27 19:39:25 -07:00