Commit Graph

3675 Commits

Author SHA1 Message Date
Aleksa Sarai 5de99cd390
tty: clean up epollConsole closing
ec0d23a92f ("tty: close epollConsole on errors") fixed a significant
issue, but the cleanup was not ideal (especially if the function is
changed in future to add additional error conditions to those currently
present). Using the defer-named-error trick avoids this issue and makes
the code more readable.

Signed-off-by: Aleksa Sarai <asarai@suse.de>
2018-09-21 11:55:36 +10:00
Mrunal Patel 00dc70017d
Merge pull request #1895 from giuseppe/fix-tty-hang
tty: close epollConsole on errors
2018-09-20 10:02:08 -07:00
Giuseppe Scrivano ec0d23a92f
tty: close epollConsole on errors
make sure epollConsole is closed before returning an error.  It solves
a hang when using these commands with a container that uses a
terminal:

runc run foo &
ssh root@localhost runc exec foo echo hello

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2018-09-20 16:51:51 +02:00
Aleksa Sarai 578fe65e4f
merge branch 'pr-1817'
Fix duplicate entries and missing entries in getCgroupMountsHelper
  Add test for testing cgroup mounts on bedrock linux
  Stop relying on number of subsystems for cgroups

LGTMs: @crosbymichael @cyphar
Closes #1817
2018-09-19 19:48:17 +10:00
Michael Crosby cc8146cf93
Merge pull request #1858 from marcov/nsenter-README
Update outdated nsenter README content
2018-09-17 10:53:19 -04:00
Michael Crosby d77251d5fc
Merge pull request #1892 from Ace-Tang/add_clean_test
test: add more test case for CleanPath
2018-09-17 10:51:17 -04:00
Michael Crosby 8facd6d2d5
Merge pull request #1886 from halfcrazy/fix/typo
doc: fix typo
2018-09-17 10:44:23 -04:00
Ace-Tang 5963cf2afc test: add more test case for CleanPath
Signed-off-by: Ace-Tang <aceapril@126.com>
2018-09-14 21:37:12 +08:00
Yan Zhu feb90346e0 doc: fix typo
Signed-off-by: Yan Zhu <yanzhu@alauda.io>
2018-09-07 11:58:59 +08:00
Michael Crosby 70ca035aa6
Merge pull request #1883 from lifubang/containeridinpath
fix delete other file bug when container id is ..
2018-09-05 13:43:21 -04:00
Mrunal Patel 9cda583235
Merge pull request #1832 from giuseppe/runc-drop-invalid-proc-destination-with-chroot
linux: drop check for /proc as invalid dest
2018-09-04 09:26:21 -07:00
Michael Crosby 784b601f68
Merge pull request #1882 from accepting/dev
libcontainer: add /proc/loadavg to the white list of bind mount
2018-09-04 11:27:45 -04:00
Lifubang 4eb30fcdbe code optimization: use securejoin.SecureJoin and CleanPath
Signed-off-by: Lifubang <lifubang@acmcoder.com>
2018-09-04 09:02:18 +08:00
Lifubang 4fae8fcce2 code optimization after review
Signed-off-by: Lifubang <lifubang@acmcoder.com>
2018-09-03 23:27:31 +08:00
Lifubang d2d226e8f9 fix unexpected delete bug when container id is ..
Signed-off-by: Lifubang <lifubang@acmcoder.com>
2018-08-31 11:17:42 +08:00
Michael Crosby fdd8055cdd
Merge pull request #1868 from rhatdan/man
Add --rootless option to man page
2018-08-30 20:28:02 -04:00
ChangFeng 3ce8fac7c4 libcontainer: add /proc/loadavg to the white list of bind mount
Signed-off-by: JunLi <lijun.git@gmail.com>
2018-08-30 21:30:23 +08:00
Giuseppe Scrivano 636b664027
linux: drop check for /proc as invalid dest
it is now allowed to bind mount /proc.  This is useful for rootless
containers when the PID namespace is shared with the host.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2018-08-30 09:56:18 +02:00
Michael Crosby 1555a78945
Merge pull request #1874 from mrunalp/drop_unused_code
Remove unused veth setup code
2018-08-27 11:07:25 -04:00
Qiang Huang 0228707b77
Merge pull request #1873 from rhatdan/ms_move
When doing a copyup, /tmp can not be a shared mount point
2018-08-27 10:08:53 +08:00
Mrunal Patel fe3d5c4c6e Remove unused veth setup code
Networking is setup by plugins for users of runc so it makes sense
to get rid of the veth strategy.

Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2018-08-24 15:41:52 -07:00
Michael Crosby 459bfaec1f
Merge pull request #1849 from adrianreber/master
Add support to checkpoint and restore into external network namespaces
2018-08-23 10:46:37 -04:00
Adrian Reber 832ac8a538
tests: add external network namespace tests
This adds a new CRIU based checkpoint/restore test to check if
the restored container runs in the same network namespace as before.

Signed-off-by: Adrian Reber <areber@redhat.com>
2018-08-22 23:27:20 +02:00
Adrian Reber fa43a72aba
criu: restore into existing namespace when specified
Using CRIU to checkpoint and restore a container into an existing
network namespace is not possible.

If the network namespace is defined like

	{
		"type": "network",
		"path": "/run/netns/test"
	}

there is the expectation that the restored container is again running in
the network namespace specified with 'path'.

This adds the new CRIU 'external namespace' feature to runc, where
during checkpointing that specific namespace is referenced and during
restore CRIU tries to restore the container in exactly that
namespace.

This breaks/fixes current runc behavior. If, without this patch, runc
restores a container with such a network namespace definition, it is
ignored and CRIU recreates a network namespace without a name.

With this patch runc uses the network namespace path (if available) to
checkpoint and restore the container in just that network namespace.

Restore will now fail if a container was checkpointed with a network
namespace path set and if that network namespace path does not exist
during restore.

runc still falls back to the old behavior if CRIU older than 3.11 is
installed.

Fixes #1786

Related to https://github.com/projectatomic/libpod/pull/469

Thanks to Andrei Vagin for all the help in getting the interface between
CRIU and runc right!

Signed-off-by: Adrian Reber <areber@redhat.com>
2018-08-22 23:27:20 +02:00
Michael Crosby 308daade45
Merge pull request #1854 from KentaTada/add-docker-proxy-settings-for-test-in-makefile
Add docker proxy settings for make test in a proxy environment
2018-08-22 13:51:47 -04:00
Kenta Tada b399167f2c Add docker proxy settings for make test in a proxy environment
This commit modifies Makefile to execute `make test` in a proxy environment.

Signed-off-by: Kenta Tada <Kenta.Tada@sony.com>
2018-08-22 18:19:48 +09:00
Qiang Huang 6b8de90552
Merge pull request #1855 from KentaTada/add-an-explanation-for-testpath-flags
Add an explanation for TESTPATH
2018-08-22 15:52:57 +08:00
Michael Crosby 9744d7958a
Merge pull request #1871 from Ace-Tang/add_mask_restore
cr: don't restore net namespace by default
2018-08-21 10:05:14 -04:00
Daniel J Walsh 62a4763a7a
When doing a copyup, /tmp can not be a shared mount point
MOVE_MOUNT will fail under certain situations.

You are not allowed to MS_MOVE if the parent directory is shared.

man mount
...
   The move operation
       Move a mounted tree to another place (atomically).  The call is:

              mount --move olddir newdir

       This  will cause the contents which previously appeared under olddir to
       now be accessible under newdir.  The physical location of the files  is
       not changed.  Note that olddir has to be a mountpoint.

       Note  also that moving a mount residing under a shared mount is invalid
       and unsupported.  Use findmnt -o TARGET,PROPAGATION to see the  current
       propagation flags.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2018-08-20 17:41:06 -04:00
Ace-Tang 4803faf00e cr: don't restore net namespace by default
since runc don't manage net device and their configuration, checkpoint
also don't dump net namespace by default, so set 'nsmask = unix.CLONE_NEWNET'
by default in restore. Or if user do not pass 'empty-ns network', criu will
cost extra time in restore.

Signed-off-by: Ace-Tang <aceapril@126.com>
2018-08-17 16:03:21 +08:00
Daniel J Walsh cb3e35b589
Add missing data to man page
Add create command
Add --rootless option to man page

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2018-08-15 20:21:13 -04:00
Aleksa Sarai 20aff4f048
merge branch 'pr-1867'
Revert "libcontainer/rootfs_linux: minor cleanup"

LGTMs: @hqhq @cyphar
Closes #1867
2018-08-15 15:42:56 +10:00
Mrunal Patel 2c3d776eb7
Merge pull request #1864 from AkihiroSuda/update-criu
Dockerfile: update criu to v3.10 + checkpoint-restore/criu@27034e7c
2018-08-14 15:59:34 -07:00
Mrunal Patel 26ec8a9783 Revert "libcontainer/rootfs_linux: minor cleanup"
This reverts commit 1b27db67f1.

Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2018-08-14 15:50:18 -07:00
Akihiro Suda e389f5757c Dockerfile: update criu to v3.10 + checkpoint-restore/criu@27034e7c
For criu v3.10, a patch is needed for `@test "checkpoint --lazy-pages and restore"`.
Starting with v3.11, the patch will no longer be needed.

The issue had not been caught in Travis because the kernel is too old and the test
had not been executed in Travis.

Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2018-08-12 14:05:44 +09:00
Marco Vedovati 34ed62697b Update outdated nsenter README content
Signed-off-by: Marco Vedovati <mvedovati@suse.com>
2018-08-07 17:53:56 +02:00
Michael Crosby 4056a41f58
Merge pull request #1830 from crosbymichael/procs
Pass GOMAXPROCS to init processes
2018-08-01 10:48:06 -04:00
Jay Kamat a2faaa1317
Fix duplicate entries and missing entries in getCgroupMountsHelper
Signed-off-by: Jay Kamat <jaygkamat@gmail.com>
2018-07-31 20:12:18 -07:00
Kenta Tada 0880503b44 Add an explanation for TESTPATH
This commit adds an explanation of TESTPATH for `make test`.

Signed-off-by: Kenta Tada <Kenta.Tada@sony.com>
2018-07-31 13:33:42 +09:00
Daniel, Dao Quang Minh beadf0ece5
Merge pull request #1841 from KentaTada/fix-makefile-modify-test-target-option
Fix the problem TESTFLAGS is not to be used in Makefile correctly
2018-07-28 22:04:22 +01:00
Michael Crosby b4e2ecb452
Merge pull request #1845 from kinvolk/alban/mount-bind-fix1753
Fix regression with mounts with non-absolute source path
2018-07-25 10:27:34 -04:00
Alban Crequy 3321aa1af7 Fix regression with mounts with non-absolute source path
PR #1753 introduced a test on the mount flags but the binary operator
was wrong, see https://github.com/opencontainers/runc/pull/1753#discussion_r203445652

This was noticed when investigating https://github.com/opencontainers/runtime-tools/issues/651

Symptoms: in the container, /proc/self/mountinfo displays some mounts as
follow:

296 279 0:67 / /tmp rw,nosuid - tmpfs /home/dpark/go/src/github.com/opencontainers/runc/tmpfs rw,size=65536k,mode=755

Signed-off-by: Alban Crequy <alban@kinvolk.io>
2018-07-18 18:30:49 +02:00
Qiang Huang bc1467269f
Merge pull request #1840 from avagin/empty-ns-network
cr: don't dump network devices and their configuration
2018-07-18 14:22:36 +08:00
Kenta Tada b681b58e8a Fix the problem TESTFLAGS is not to be used in Makefile correctly
This commit modifies Makefile to handle test targets correctly.

Signed-off-by: Kenta Tada <Kenta.Tada@sony.com>
2018-07-11 17:50:47 +09:00
Andrei Vagin 8187fb740c cr: don't dump network devices and their configuration
RunC doesn't manage network devices and their configuration,
so it is impossible to describe external dependencies to restore them
back.

This means that all users have to set --empty-ns network, so let's do
this by default.

Signed-off-by: Andrei Vagin <avagin@openvz.org>
2018-07-10 23:24:19 -07:00
Michael Crosby 21ac0862f2
Merge pull request #1838 from adrianreber/lazy
criu tests: rename criu feature check
2018-07-10 10:09:40 -04:00
Aleksa Sarai 45e08f6ceb
merge branch 'pr-1836'
Add osusergo flag to static build

LGTMs: @crosbymichael @cyphar
Closes #1836
2018-07-05 15:05:32 +10:00
Adrian Reber 46221e3953
criu tests: rename criu feature check
Upstream renamed the feature check for lazy migration support from
'lazy_pages' to 'uffd'. The lazy migration test case was therefore
not running at all. This enables the lazy migration test case in runc
again.

The test will, however, not run in travis as the kernel is too old.
But it works again locally.

Signed-off-by: Adrian Reber <areber@redhat.com>
2018-07-03 17:35:22 +02:00
Kir Kolyshkin 7fb79f318d Add osusergo flag to static build
This should fix the following (very legitimate) warnings on static
build:

> /tmp/go-link-818454663/000019.o: In function `mygetgrouplist':
> /usr/lib/go-1.10/src/os/user/getgrouplist_unix.go:15: warning: Using
> 'getgrouplist' in statically linked applications requires at runtime the
> shared libraries from the glibc version used for linking
>
> /tmp/go-link-818454663/000018.o: In function `mygetgrgid_r':
> /usr/lib/go-1.10/src/os/user/cgo_lookup_unix.go:38: warning: Using
> 'getgrgid_r' in statically linked applications requires at runtime the
> shared libraries from the glibc version used for linking
>
> ...

as well as segfaults in the resulting binary.

For more details, check https://github.com/golang/go/issues/23265

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2018-07-02 13:43:21 -07:00
Michael Crosby 53fddb540a Pass GOMAXPROCS to init processes
This will help runc's init to not spawn many threads on large systems when
launched with max procs by the caller.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2018-06-26 11:23:37 -04:00