Commit Graph

3750 Commits

Author SHA1 Message Date
Tibor Vass 10a4cde4b9 Fix make shell
The "shell" rule in the Makefile uses docker to run a bash session,
however it was depending on the "all" rule which assumes non-docker local
development. This commit fixes it by making it depend on the "runcimage" rule.

Signed-off-by: Tibor Vass <tibor@docker.com>
2018-02-28 05:23:03 +00:00
Aleksa Sarai 4bb1fe4ace
release v1.0.0~rc5
VERSION: back to development
  VERSION: bump to v1.0.0-rc5

Votes: +5 -0 #2
LGTMs: @crosbymichael @cyphar @dqminh @hqhq @mrunalp
Closes #1739
2018-02-28 03:47:26 +11:00
Michael Crosby d32757b0cf
Merge pull request #1711 from dqminh/update-build-dep
Update build dependencies in Dockerfile
2018-02-27 11:41:04 -05:00
Aleksa Sarai 442a6cff7e
VERSION: back to development
Signed-off-by: Aleksa Sarai <asarai@suse.de>
2018-02-27 12:25:04 +11:00
Aleksa Sarai 4fc53a81fb
VERSION: bump to v1.0.0-rc5
This is planned to be the last -rc release before 1.0.0.

Signed-off-by: Aleksa Sarai <asarai@suse.de>
2018-02-27 12:25:04 +11:00
Aleksa Sarai 757e78bebd
merge branch 'pr-1743'
The setupUserNamespace function is always called.

LGTMs: @crosbymichael @mrunalp @cyphar
Closes #1743
2018-02-27 12:22:52 +11:00
Michael Crosby 8aca07289d
Merge pull request #1736 from allencloud/fix-lint-warning
fix lint error in specconv
2018-02-26 14:21:26 -05:00
ynirk 2420eb1f4d The setupUserNamespace function is always called.
The function is called even if the usernamespace is not set.
This results having wrong uid/gid set on devices.

This fix add a test to check if usernamespace is set befor calling
setupUserNamespace.

Fixes #1742

Signed-off-by: Julien Lavesque <julien.lavesque@gmail.com>
2018-02-26 14:27:11 +01:00
Daniel Dao 8be31629cf upgrade criu to v3.7
The current version of criu bundled in dockerfile failed to do checkpoint/restore test on my
system (v4.14.14). Upgrade to latest version v3.7 and also change the
repository name to point to the current official repo.

Signed-off-by: Daniel Dao <dqminh89@gmail.com>
2018-02-26 11:48:39 +00:00
Daniel Dao 121c7b458e upgrade to go 1.10 with debian stretch
This also remove jessie-backport version of libseccomp and just use
stretch bundled version

Signed-off-by: Daniel Dao <dqminh89@gmail.com>
2018-02-26 11:48:11 +00:00
Allen Sun 3f32e72963 fix lint error in specconv
Signed-off-by: Allen Sun <allensun.shl@alibaba-inc.com>
2018-02-26 15:39:54 +08:00
Qiang Huang b50fa98d9e
Merge pull request #1727 from pmorjan/update-console
Update console dependency to fix runc exec on BE
2018-02-22 15:40:44 +08:00
Qiang Huang e59b6d4b9b
Merge pull request #1729 from vsoch/patch-2
adding go get instruction to readme
2018-02-22 15:38:43 +08:00
vsoch 0f3d824550 adding go get instruction to readme
Signed-off-by: Vanessa Sochat <vsochat@stanford.edu>
2018-02-21 12:54:21 -08:00
Peter Morjan 59e5b61c5c Update console dependency to fix runc exec on BE
This fixes a bug in the console package for big-endian architectures.
When creating a new pty the returned path to the new pty slave was
wrong for the second und all subsequent ptys.
In runc the exec subcommand failed with an runtime error such as
`container_linux.go:265: starting container process caused "open
/dev/pts/4294967296: no such file or directory"`.
The number is shifted by 32.

Signed-off-by: Peter Morjan <peter.morjan@de.ibm.com>
2018-02-21 10:43:06 +01:00
Michael Crosby 595bea022f
Merge pull request #1722 from ravisantoshgudimetla/fix-systemd-path
fix systemd slice expansion so that it could be consumed by cAdvisor
2018-02-20 09:59:24 -05:00
Michael Crosby 6988afe05d
Merge pull request #1724 from wking/no-pid-for-capability-lookup
libcontainer/capabilities_linux: Drop os.Getpid() call
2018-02-20 09:40:33 -05:00
W. Trevor King 50dc7ee96c libcontainer/capabilities_linux: Drop os.Getpid() call
gocapability has supported 0 as "the current PID" since
syndtr/gocapability@5e7cce49 (Allow to use the zero value for pid to
operate with the current task, 2015-01-15, syndtr/gocapability#2).
libcontainer was ported to that approach in 444cc298 (namespaces:
allow to use pid namespace without mount namespace, 2015-01-27,
docker/libcontainer#358), but the change was clobbered by 22df5551
(Merge branch 'master' into api, 2015-02-19, docker/libcontainer#388)
which landed via 5b73860e (Merge pull request #388 from docker/api,
2015-02-19, docker/libcontainer#388).  This commit restores the
changes from 444cc298.

Signed-off-by: W. Trevor King <wking@tremily.us>
2018-02-19 15:47:42 -08:00
ravisantoshgudimetla 7019e1de7b fix systemd slice expansion so that it could be consumed by cAdvisor
Signed-off-by: ravisantoshgudimetla <ravisantoshgudimetla@gmail.com>
2018-02-18 21:32:39 -05:00
Michael Crosby a618ab5a01
Merge pull request #1695 from Taeung/fix-console-man
man: Fix manpages related to console
2018-02-08 10:28:41 -05:00
Qiang Huang 7af2e25c66
Merge pull request #1685 from Taeung/check-md2man
Warning message if 'go-md2man' is not yet installed
2018-02-08 09:13:44 +08:00
Mrunal Patel 6e15bc3f92
Merge pull request #1702 from crosbymichael/chroot
chroot when no mount namespaces is provided
2018-02-07 10:09:35 -08:00
Michael Crosby 6c55f98695
Merge pull request #1703 from wking/state-test-helper
libcontainer/state_linux_test: Add a testTransitions helper
2018-02-02 11:47:41 -05:00
Taeung Song 72f92cf986
Warning message if 'go-md2man' is not yet installed
If 'go-md2man' is not installed,
an error can occur when running md2man-all.sh like below:

    $ ./man/md2man-all.sh -q
    ./man/md2man-all.sh: line 21: go-md2man: command not found

So fix it.

Signed-off-by: Taeung Song <treeze.taeung@gmail.com>
2018-02-02 21:51:57 +09:00
Michael Crosby 9a270e2dae
Merge pull request #1706 from unshare/pr-2
kill.go: Remove unnecessary checks
2018-01-29 11:14:03 -05:00
Valentin Kulesh 7ac503d1a2
kill.go: Remove unnecessary checks
... that prevent sending signals not mentioned in signal map.
Currently these are SIGRTMIN..SIGRTMAX.

Signed-off-by: Valentin Kulesh <valentin.kulesh@virtuozzo.com>
2018-01-26 09:52:05 +03:00
W. Trevor King be16b13645 libcontainer/state_linux_test: Add a testTransitions helper
The helper DRYs up the transition tests and makes it easy to get
complete coverage for invalid transitions.

I'm also using t.Run() for subtests.  Run() is new in Go 1.7 [1], but
runc dropped support for 1.6 back in e773f96b (update go version at
travis-ci, 2017-02-20, #1335).

[1]: https://blog.golang.org/subtests

Signed-off-by: W. Trevor King <wking@tremily.us>
2018-01-25 11:18:45 -08:00
Michael Crosby 91ca331474 chroot when no mount namespaces is provided
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2018-01-25 11:36:37 -05:00
Michael Crosby c4e4bb0df2
Merge pull request #1699 from AkihiroSuda/indent-c
make: validate C format
2018-01-25 10:09:09 -05:00
Aleksa Sarai 5a46c2ba8b
nsenter: move namespace creation after userns creation
Technically, this change should not be necessary, as the kernel
documentation claims that if you call clone(flags|CLONE_NEWUSER), the
new user namespace will be the owner of all other namespaces created in
@flags. Unfortunately this isn't always the case, due to various
additional semantics and kernel bugs.

One particular instance is SELinux, which acts very strangely towards
the IPC namespace and mqueue. If you unshare the IPC namespace *before*
you map a user in the user namespace, the IPC namespace's internal
kern-mount for mqueue will be labelled incorrectly and the container
won't be able to access it. The only way of solving this is to unshare
IPC *after* the user has been mapped and we have changed to that user.
I've also heard of this happening to the NET namespace while talking to
some LXC folks, though I haven't personally seen that issue.

This change matches our handling of user namespaces to be the same as
how LXC handles these problems.

Signed-off-by: Aleksa Sarai <asarai@suse.de>
2018-01-25 23:56:49 +11:00
Akihiro Suda dd5eb3b9e3 make: validate C format
Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2018-01-24 10:49:50 +09:00
Michael Crosby 9f9c96235c
Merge pull request #1698 from cloudfoundry-incubator/exec-fifo-race
Avoid race when opening exec fifo
2018-01-23 09:57:53 -05:00
Ed King 5c0af14bf8 Return from goroutine when it should terminate
Signed-off-by: Craig Furman <cfurman@pivotal.io>
2018-01-23 10:46:31 +00:00
Will Martin 8d3e6c9826 Avoid race when opening exec fifo
When starting a container with `runc start` or `runc run`, the stub
process (runc[2:INIT]) opens a fifo for writing. Its parent runc process
will open the same fifo for reading. In this way, they synchronize.

If the stub process exits at the wrong time, the parent runc process
will block forever.

This can happen when racing 2 runc operations against each other: `runc
run/start`, and `runc delete`. It could also happen for other reasons,
e.g. the kernel's OOM killer may select the stub process.

This commit resolves this race by racing the opening of the exec fifo
from the runc parent process against the stub process exiting. If the
stub process exits before we open the fifo, we return an error.

Another solution is to wait on the stub process. However, it seems it
would require more refactoring to avoid calling wait multiple times on
the same process, which is an error.

Signed-off-by: Craig Furman <cfurman@pivotal.io>
2018-01-22 17:03:02 +00:00
Taeung Song 862e491163
man: Fix manpages related to console
The commit 244c9fc ("*: console rewrite")
removed the --console option and the commit 7df64f8
("runc: implement --console-socket") create new option
--console-socket. However, the old --console option
still exists so fix it.

In addtion, add missing --preserve-fds option to
create and run manpages.

Signed-off-by: Taeung Song <treeze.taeung@gmail.com>
Signed-off-by: charsyam <charsyam@naver.com>
2018-01-17 17:37:12 +09:00
Mrunal Patel ab4a819167
Merge pull request #1687 from runcom/annotations-hooks
libcontainer: expose annotations in hooks
2018-01-12 12:11:04 -08:00
Antonio Murdaca cd1e7abee2
libcontainer: expose annotations in hooks
Annotations weren't passed to hooks. This patch fixes that by passing
annotations to stdin for hooks.

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2018-01-11 16:54:01 +01:00
Michael Crosby 0aa69f2d6c
Merge pull request #1682 from BooleanCat/master
Pin version of gojsonschema in tests
2018-01-11 10:46:33 -05:00
Qiang Huang 96086e56f5
Merge pull request #1683 from vikaschoudhary16/runc-systemd-race
Fix race against systemd
2018-01-09 09:30:58 +08:00
vikaschoudhary16 d5b4a3eddb Fix race against systemd
- T0: runc triggers a systemd unit creation asynchronously from [here](https://github.com/opencontainers/runc/blob/master/libcontainer/cgroups/systemd/apply_systemd.go#L298)
- T1: runc then moves ahead and starts creating cgroup paths(.scope directories), [here](https://github.com/opencontainers/runc/blob/master/libcontainer/cgroups/systemd/apply_systemd.go#L348). Kernel creates .scope directory and cgroup.procs file(along with other default files) in the directory automatically, in an atomic manner.
- T3: systemd execution thread which was invoked at time `T0`, is still in the process of unit creation. systemd also trying to create cgroup paths and deletes the `.scope` directory which is created at time `T1` by runc from [here](https://github.com/systemd/systemd/blob/v219/src/shared/cgroup-util.c#L1630) in the code

Signed-off-by: vikaschoudhary16 <choudharyvikas16@gmail.com>
2018-01-08 09:37:26 -05:00
Tom Godkin a1edc03c49 Pin version of gojsonschema in tests
Signed-off-by: Will Martin <wmartin@pivotal.io>
2018-01-04 15:11:45 +00:00
Mrunal Patel e6516b3d5d
Merge pull request #1678 from sboeuf/sboeuf/subreaper
libcontainer: Do not wait for signalled processes if subreaper is set
2017-12-15 08:47:07 -08:00
Michael Crosby 7f24b40cc5
Merge pull request #1675 from tklauser/apparmor-no-cgo
RFC: libcontainer: remove dependency on libapparmor
2017-12-15 11:23:35 -05:00
Tobias Klauser db093f621f libcontainer: remove dependency on libapparmor
libapparmor is integrated in libcontainer using cgo but is only used to
call a single function: aa_change_onexec. It turns out this function is
simple enough (writing a string to a file in /proc/<n>/attr/...) to be
re-implemented locally in libcontainer in plain Go.

This allows to drop the dependency on libapparmor and the corresponding
cgo integration.

Fixes #1674

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2017-12-15 09:59:58 +01:00
Sebastien Boeuf bb912eb00c libcontainer: Do not wait for signalled processes if subreaper is set
When a subreaper is enabled, it might expect to reap a process and
retrieve its exit code. That's the reason why this patch is giving
the possibility to define the usage of a subreaper as a consumer of
libcontainer. Relying on this information, libcontainer will not
wait for signalled processes in case a subreaper has been set.

Fixes #1677

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2017-12-14 10:37:38 -08:00
Mrunal Patel c6e4a1ebeb
Merge pull request #1665 from Mashimiao/gidmapping-valid-fix
specconv: avoid skipping gidmappings applied when uidmappings is empty
2017-12-11 09:50:54 -08:00
Mrunal Patel b028413c35
Merge pull request #1655 from Mashimiao/add-propagation-more
support unbindable,runbindable for rootfs propagation
2017-12-11 09:21:41 -08:00
Michael Crosby 0fdc908bf1
Merge pull request #1667 from allencloud/patch-2
Update criu_opts_linux.go
2017-12-11 09:37:01 -05:00
Michael Crosby bdee9adedc
Merge pull request #1669 from Mashimiao/stopped-checkpoint
stopped container can't be checkpoint
2017-12-10 21:39:13 -05:00
Ma Shimiao 5061fd3e6e stopped container can't be checkpoint
Signed-off-by: Ma Shimiao <mashimiao.fnst@cn.fujitsu.com>
2017-12-07 15:43:56 +08:00