Commit Graph

4797 Commits

Author SHA1 Message Date
Kir Kolyshkin 11680cd2c7 libct: fix "unused" linter warning
Commit 4415446c32 introduces this function which is never used.
Remove it.

This fixes

> libcontainer/container_linux.go:1813:26: func `(*linuxContainer).deleteState` is unused (unused)

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2020-12-03 10:24:27 -08:00
Kir Kolyshkin a99ecc9ea2 libct/cg/utils: silence a linter warning
> libcontainer/cgroups/utils.go:282:4: SA4006: this value of `paths` is never used (staticcheck)
>			paths = make(map[string]string)

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2020-12-03 10:24:27 -08:00
Akihiro Suda bd013b6e4d Merge pull request #2698 from cyphar/memfd_create-hardcode-sysnum
nsenter: hard-code memfd_create(2) syscall numbers
2020-12-03 12:01:21 +09:00
Mrunal Patel 56a1f1f70f Merge pull request #2697 from kolyshkin/validate-nits
.github/workflows/validate: nits
2020-12-02 10:20:38 -08:00
Akihiro Suda 351787708a Merge pull request #2679 from thaJeztah/isolate_device
libcontainer: isolate libcontainer/devices
2020-12-02 18:00:38 +09:00
Aleksa Sarai 3aead32ea2 nsenter: hard-code memfd_create(2) syscall numbers
Some libc versions still in use by distributions (such as SLE) do not
define SYS_memfd_create even though the kernel supports the feature.
Since the syscall numbers are fixed, we can just hard-code them if
__NR_memfd_create is not defined.

We only do this for a handful of architectures, since containers aren't
widely supported on every possible Linux architecture.

Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
2020-12-02 19:56:39 +11:00
Akihiro Suda 2a50985a8a Merge pull request #2694 from kolyshkin/recvtty-nits
recttty: nits
2020-12-02 11:07:39 +09:00
Kir Kolyshkin 5d1b0268dd .github/workflows/validate: nits
1. Use ubuntu-20.04 instead of ubuntu-latest to fix warnings like

> Ubuntu-latest workflows will use Ubuntu-20.04 soon. For more details,
> see https://github.com/actions/virtual-environments/issues/1816

2. Minor formatting fixes, remove redundant name: etc.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2020-12-01 17:24:18 -08:00
Sebastiaan van Stijn 4fc2de77e9 libcontainer/devices: remove "Device" prefix from types
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-12-01 11:11:23 +01:00
Sebastiaan van Stijn 677baf22d2 libcontainer: isolate libcontainer/devices
Move the Device-related types to libcontainer/devices, so that
the package can be used in isolation. Aliases have been created
in libcontainer/configs for backward compatibility.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-12-01 11:11:21 +01:00
Kir Kolyshkin de80aae4bc recvtty: fix errcheck linter warnings
Fixes the following errcheck linter warnings

> contrib/cmd/recvtty/recvtty.go:115:10: Error return value of `io.Copy` is not checked (errcheck)
> 		io.Copy(os.Stdout, c)
> 		       ^
> contrib/cmd/recvtty/recvtty.go:120:11: Error return value of `io.Copy` is not checked (errcheck)
> 			io.Copy(c, os.Stdin)
> 			       ^
> contrib/cmd/recvtty/recvtty.go:175:11: Error return value of `io.Copy` is not checked (errcheck)
>			io.Copy(devnull, master)
>			       ^

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2020-11-30 19:30:13 -08:00
Kir Kolyshkin 6b41b463b1 recvtty: fix waiting for both goroutines
It looks like we need to wait for the both copy goroutines to finish,
not just the one that happen to finish first.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2020-11-30 19:30:13 -08:00
Kir Kolyshkin 4bbfd2e114 recvtty: use ioutil.Discard
Saves us a few lines of code.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2020-11-30 19:30:13 -08:00
Mrunal Patel 2b92c25130 Merge pull request #2690 from kolyshkin/gh-act-int
ci: add integration / unit tests to github actions
2020-11-30 13:27:39 -08:00
Mrunal Patel 7cfb3dcfa2 Merge pull request #2692 from kolyshkin/test-tty-nits
tests/int/tty.bats: increase timeout
2020-11-29 17:42:11 -08:00
Kir Kolyshkin c1ef0cf62c ci: add integration+unit tests to github actions
This is Ubuntu 20.04 so cgroup v1 testing only :(
The upside is, it's pretty fast (currently all the tests finish
within 5 minutes).

rootless tests take longer time so we run them in parallel
with non-rootless ones. Also, to balance the time, we run
unit tests when rootless is not set. IOW, 'rootless' in job
name means it's only rootless integration tests, and no rootless
means it's unit tests, integration tests with fs driver, and
integration tests with systemd driver.

Note, `script` is used to run integration tests to provide a tty
(which by default is not available on gh actions).

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2020-11-27 21:35:02 -08:00
Kir Kolyshkin fce8dd4d66 tests/int/tty.bats: increase timeout
Just saw the timeout being hit on CI (Fedora 33 vagrant VM on Travis),
so let's increase it.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2020-11-27 14:15:32 -08:00
Mrunal Patel 06b737bb15 Merge pull request #2687 from kolyshkin/more-github-actions
More GitHub actions
2020-11-23 21:02:51 -08:00
Akihiro Suda d15ffff5df Merge pull request #2681 from thaJeztah/fix_bats_link
integration: update README to link to bats-core
2020-11-24 02:02:03 +09:00
Akihiro Suda 0b11e29a87 Merge pull request #2684 from thaJeztah/bump_ebpf
vendor: github.com/cilium/ebpf v0.2.0
2020-11-23 03:44:12 +09:00
Akihiro Suda 69d84cb12d Merge pull request #2688 from kolyshkin/criu-3.15
Dockerfile: bump criu to 3.15
2020-11-23 03:42:07 +09:00
Kir Kolyshkin c6ed18542d ci: add shellcheck to github actions
Note that

1. No golang caching is required, since we do not build any go code,
   and it does not look like it make sense to cache a single binary
   we donwload from github.

2. Use a problem matcher, so the PRs will be annotated with
   shellcheck warnings.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2020-11-20 10:35:56 -08:00
Kir Kolyshkin 27835a9e5e Makefile: move shellcheck out of validate
This serves two purposes:

1. A developer can now run `make shellcheck` to show  any issues    with
   shell or bats files formatting (this requires a recent version of
   shfmt, which I think is out of scope for Makefile).

2. Exclude shellcheck from travis ci (will be re-added as a GH action
   by the next commit).

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2020-11-20 10:35:56 -08:00
Kir Kolyshkin 33bda24ac3 ci: move verify-deps from travis to github actions
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2020-11-20 10:35:56 -08:00
Kir Kolyshkin c60f23b335 ci: add shfmt to github actions
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2020-11-20 10:35:56 -08:00
Kir Kolyshkin 717a73b397 ci: renamed golangci-lint to validate
...so we can add more validation-type jobs.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2020-11-20 10:35:56 -08:00
Kir Kolyshkin 06b204e5c2 Makefile: move shfmt out of validate, add -w
This serves two purposes:

1. A developer can now run `make shfmt` to show and fix any issues
   with shell or bats files formatting (this requires a recent version
   of shfmt, which I think is out of scope for Makefile).

2. Exclude shfmt check from travis ci (will be re-added as a GH action
   by the next commit).

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2020-11-20 10:35:56 -08:00
Kir Kolyshkin 7856c34018 Dockerfile: bump criu to 3.15
Changes: see https://criu.org/Download/criu/3.15

Note in Vagrant.centos7 we use Adrian's repo [1] which already have criu
3.15, and in Vagrant.fedora33 we use stock fedora which also already has
criu 3.15.

[1] https://copr.fedorainfracloud.org/coprs/adrian/criu-el7/packages/

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2020-11-20 10:35:32 -08:00
Sebastiaan van Stijn ee1bdb80af vendor: github.com/cilium/ebpf v0.2.0
full diff: https://github.com/cilium/ebpf/compare/v0.1.0...v0.2.0

- btf: add go-fuzz targets
- btf: avoid Type copy in FuncProto.walk
- btf: check err in loadSpecFromVmlinux
- btf: handle type name flavours
- CI: test on 5.9 kernel
- cmd/bpf2go: output ELF .o next to the .go file
- link: add AttachSkLookup
- Remove two unused functions
- Support LSM attach
- use buffered I/O to cut down on read syscalls
- Various doc link fixes

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-11-20 13:56:46 +01:00
Akihiro Suda b69070a5fc Merge pull request #2686 from kolyshkin/fix-kubic-repo
Dockefile: fix path to skopeo repo
2020-11-20 17:55:11 +09:00
Kir Kolyshkin f0d5e83966 Dockefile: fix path to skopeo repo
The current URL now gives 404. I looked in there and found that
apparently Debian_Unstable becomes Debian_10. Fix the URLs accordingly.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2020-11-19 18:19:01 -08:00
Akihiro Suda 689513cc09 Merge pull request #2643 from xiaochenshen/rdt-cmt-check
libcontainer/intelrdt: fix CMT feature check
2020-11-18 01:56:22 +09:00
Sebastiaan van Stijn d9010b0e2d integration: update README to link to bats-core
We switched to bats-core in commit d4bc7c10ec,
so updating the instructions to match.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-11-17 17:46:04 +01:00
Kir Kolyshkin 636f23dd21 Merge pull request #2674 from AkihiroSuda/graduate-cgroup2-experimental
Move cgroup v2 out of experimental
2020-11-10 15:16:03 -08:00
Michael Crosby f4440f9b89 Merge pull request #2665 from AkihiroSuda/fedora33
CI: update Fedora to 33
2020-11-10 10:47:32 -05:00
Michael Crosby 104c493a9b Merge pull request #2676 from KentaTada/modify-doc-of-passthrough
docs: terminals: modify the example of Pass-Through mode.
2020-11-10 10:46:54 -05:00
Michael Crosby 295e4e0772 Merge pull request #2677 from xiaochenshen/rdt-rename-cat-mba-flags
libcontainer/intelrdt: rename CAT and MBA enabled flags
2020-11-10 10:46:13 -05:00
Akihiro Suda 3f2f06dfe1 Move cgroup v2 out of experimental
After a lot of refactoring, our cgroup v1 and v2 drivers now have same level of implementation quality,
so we can move the v2 driver out of experimental.

Close #2663

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2020-11-10 17:07:06 +09:00
Xiaochen Shen f62ad4a0de libcontainer/intelrdt: rename CAT and MBA enabled flags
Rename CAT and MBA enabled flags to be consistent with others.
No functional change.

Signed-off-by: Xiaochen Shen <xiaochen.shen@intel.com>
2020-11-10 15:32:01 +08:00
Mrunal Patel 30233a7aea Merge pull request #2675 from AkihiroSuda/vendor-20201109
update vendor
2020-11-09 21:26:49 -08:00
Xiaochen Shen 620f4c5c88 libcontainer/intelrdt: fix CMT feature check
Intel RDT sub-features can be selectively disabled or enabled by kernel
command line. See "rdt=" option details in kernel document:
https://www.kernel.org/doc/Documentation/admin-guide/kernel-parameters.txt

But Cache Monitoring Technology (CMT) feature is not correctly checked
in init() and getCMTNumaNodeStats() now. If CMT is disabled by kernel
command line (e.g., rdt=!cmt,mbmtotal,mbmlocal,l3cat,mba) while hardware
supports CMT, we may get following error when getting Intel RDT stats:
  runc run c1
  runc events c1
  ERRO[0005] container_linux.go:200: getting container's Intel RDT stats
  caused: open /sys/fs/resctrl/c1/mon_data/mon_L3_00/llc_occupancy: no
  such file or directory

Fix CMT feature check in init() and GetStats() call paths.

Signed-off-by: Xiaochen Shen <xiaochen.shen@intel.com>
2020-11-10 10:36:20 +08:00
Akihiro Suda fb59e6f726 Merge pull request #2583 from adrianreber/join-more-namespaces
restore: tell CRIU to use existing namespaces
2020-11-10 00:19:40 +09:00
Kenta Tada 896da0b95e docs: terminals: modify the example of Pass-Through mode.
This commit removes the unnecessary ampersand.
Especially, it causes the error of "ambiguous redirect" when use bash.

Signed-off-by: Kenta Tada <Kenta.Tada@sony.com>
2020-11-09 17:10:52 +09:00
Akihiro Suda 4690064f05 update vendor
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2020-11-09 15:14:23 +09:00
Mrunal Patel 27227a9358 Merge pull request #2669 from kolyshkin/systemd-unified
Initial v2 resources.unified systemd support
2020-11-06 12:31:31 -08:00
Akihiro Suda e8498d3ad5 Merge pull request #2672 from giuseppe/fix-remount-readonly
linux: fix remount readonly in a user namespace
2020-11-06 20:40:46 +09:00
Akihiro Suda 9403afd75c CI: Fedora 33: print kernel version, systemd version, and rootfs type
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2020-11-06 20:30:04 +09:00
Akihiro Suda 0a097615c0 CI: update Fedora to 33
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2020-11-06 20:30:01 +09:00
Giuseppe Scrivano 41aa764010 linux: drop MS_REC for readonly remount
it has no effect.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2020-11-06 11:36:50 +01:00
Giuseppe Scrivano a4e6955e31 linux: fix remount readonly in a user namespace
if we are remounting root read only when in a user namespace, make
sure the existing flags (e.g. MS_NOEXEC, MS_NODEV) are maintained
otherwise the mount fails with EPERM.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2020-11-06 11:35:40 +01:00