Commit Graph

2360 Commits

Author SHA1 Message Date
rajasec 94b206102f Adding user namespace in README
Signed-off-by: rajasec <rajasec79@gmail.com>

Added UID/GID mappings section as per review comments

Signed-off-by: rajasec <rajasec79@gmail.com>

Added UID/GID mappings section as per review comments

Signed-off-by: rajasec <rajasec79@gmail.com>

Change size to 65536 per comments

Signed-off-by: rajasec <rajasec79@gmail.com>
2016-01-25 07:07:44 +05:30
Qiang Huang 690e5d3251 Merge pull request #441 from ZJU-SEL/update-date
update date in README
2016-01-25 09:22:55 +08:00
Michael Crosby 59f3066c39 Merge pull request #405 from marcosnils/spec_version
Add spec version to runC version cli
2016-01-22 13:55:28 -08:00
Mrunal Patel 1fdcf95ab1 Merge pull request #505 from marcosnils/patch-1
Add build status badge
2016-01-22 13:10:11 -08:00
Marcos Nils 7871e987ca Add build status badge
Signed-off-by: Marcos Lilljedahl <marcosnils@gmail.com>
2016-01-22 16:47:30 -03:00
Qiang Huang 4e6893b05a Merge pull request #494 from crosbymichael/cwd
Only set cwd when not empty
2016-01-22 09:50:38 +08:00
Qiang Huang 20c678ef50 Merge pull request #495 from cyphar/fix-memcg-set
cgroups: set memory cgroups in Set
2016-01-22 09:22:39 +08:00
Michael Crosby 9c3fa7928e Allow switch to anything from nullState
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2016-01-21 16:48:05 -08:00
Michael Crosby 556f798a19 Fix various state bugs for pause and destroy
There were issues where a process could die before pausing completed
leaving the container in an inconsistent state and unable to be
destoryed.  This makes sure that if the container is paused and the
process is dead it will unfreeze the cgroup before removing them.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2016-01-21 16:43:33 -08:00
Mrunal Patel 27132f2e51 Merge pull request #486 from duglin/removeHardCode
Remove some hard coded strings
2016-01-21 14:53:17 -08:00
Mrunal Patel 3cae88cc55 Merge pull request #490 from hqhq/hq_fix_comment_swap
Fix comment of swap limit
2016-01-21 14:49:37 -08:00
Aleksa Sarai 75e38f94a0 cgroups: set memory cgroups in Set
Modify the memory cgroup code such that kmem is not managed by Set(), in
order to allow updating of memory constraints for containers by Docker.
This also removes the need to make memory a special case cgroup.

Signed-off-by: Aleksa Sarai <asarai@suse.com>
2016-01-22 07:46:43 +11:00
Michael Crosby ed7be1d082 Only set cwd when not empty
For existing consumers of libconatiner to not require cwd inside the
libcontainer code.  This can be done at the runc level and is already
evaluated there.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2016-01-21 11:08:32 -08:00
Qiang Huang 8bbe901045 Fix comment of swap limit
Set `-1` doesn't mean disable swap, disable swap means you
can't use swap memory, set `-1` really means you can use
unlimited swap memory.

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
2016-01-21 14:02:03 +08:00
Qiang Huang 986637c97a Merge pull request #466 from mrunalp/cgroup_apply_paths
Add support for just joining in apply using cgroup paths
2016-01-21 08:51:33 +08:00
Mrunal Patel 41d9d26513 Add support for just joining in apply using cgroup paths
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2016-01-20 14:23:05 -05:00
Doug Davis 49dfa1b62d Remove some hard coded strings
Signed-off-by: Doug Davis <dug@us.ibm.com>
2016-01-19 19:02:31 -08:00
Mrunal Patel e91b055623 Merge pull request #476 from hqhq/hq_embed_resource
Embed Resources for backward compatibility
2016-01-19 14:59:39 -08:00
Michael Crosby 5637f38b8a Merge pull request #471 from jfrazelle/add-seccomp-enabled-check
add seccomp.IsEnabled() function
2016-01-19 14:52:51 -08:00
Michael Crosby 9c41e8388c
Handle seccomp proc parsing errors
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2016-01-19 11:43:49 -08:00
Qiang Huang f048eaf87a Embed Resources for backward compatibility
Fixes: docker/docker#19329

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
2016-01-19 19:08:14 +08:00
Jessica Frazelle 41edbeb25e
add seccomp.IsEnabled() function
This is much like apparmor.IsEnabled() function and a nice helper.

Signed-off-by: Jessica Frazelle <acidburn@docker.com>
2016-01-18 10:44:31 -08:00
Alexander Morozov 96530dbe27 Merge pull request #481 from jfrazelle/cleanup-old-hack-dir
cleanup old hack dir
2016-01-18 08:40:17 -08:00
Qiang Huang 809235019f Merge pull request #480 from mrunalp/cwd_abs
Check that cwd is absolute
2016-01-18 10:09:02 +08:00
Jessica Frazelle ecf03fafa5
cleanup old hack dir
looks like this was left around from the libcontainer days ;)

Signed-off-by: Jessica Frazelle <acidburn@docker.com>
2016-01-15 16:39:38 -08:00
Mrunal Patel c323574797 Check that cwd is absolute
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2016-01-15 19:06:27 -05:00
Alexander Morozov 54b07da69e Merge pull request #475 from mrunalp/set_cwd
Make cwd required
2016-01-15 13:54:35 -08:00
Alexander Morozov 6c9532f063 Merge pull request #461 from ahmetalpbalkan/selinux-setenforce
selinux: add SelinuxSetEnforceMode implementation
2016-01-15 13:01:27 -08:00
Alexander Morozov f2f8f0e4e6 Merge pull request #462 from hqhq/hq_fix_libcontainer_readme
Update README of libcontainer
2016-01-15 13:00:44 -08:00
Alexander Morozov 96982e3fc9 Merge pull request #478 from jfrazelle/update-go-version
update go version to 1.5.3 in dockerfile and cleanup
2016-01-15 12:59:04 -08:00
Jessica Frazelle 5f89a91559
update go version to 1.5.3 in dockerfile and cleanup
Signed-off-by: Jessica Frazelle <acidburn@docker.com>
2016-01-15 10:56:34 -08:00
Mrunal Patel 6259f09e97 Merge pull request #426 from gitido/pressure_level
libcontainer: Add support for memcg pressure notifications
2016-01-14 16:23:07 -08:00
Mrunal Patel 269a717555 Make cwd required
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2016-01-14 19:06:56 -05:00
Alexander Morozov 8962f371d6 Merge pull request #472 from dadgar/b-find-cgroup-mount
Only validate post-hyphen field length on cgroup mounts
2016-01-14 15:08:11 -08:00
Alexander Morozov 3b42992948 Merge pull request #455 from hallyn/tty01
Do not allow access to /dev/tty{0,1}
2016-01-14 14:35:46 -08:00
Qiang Huang d87ac4a2ca Update README of libcontainer
Fixes: #438

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
2016-01-14 14:53:29 +08:00
Alex Dadgar a42f3236d5 Only validate post-hyphen field length on cgroup mounts
Signed-off-by: Alex Dadgar <alex.dadgar@gmail.com>
2016-01-13 11:28:49 -08:00
Mrunal Patel 4c767d7046 Merge pull request #446 from cyphar/18-add-pids-controller
cgroup: add PIDs cgroup controller support
2016-01-11 16:56:00 -08:00
Aleksa Sarai 103853ead7 libcontainer: set cgroup config late
Due to the fact that the init is implemented in Go (which seemingly
randomly spawns new processes and loves eating memory), most cgroup
configurations are required to have an arbitrary minimum dictated by the
init. This confuses users and makes configuration more annoying than it
should. An example of this is pids.max, where Go spawns multiple
processes that then cause init to violate the pids cgroup constraint
before the container can even start.

Solve this problem by setting the cgroup configurations as late as
possible, to avoid hitting as many of the resources hogged by the Go
init as possible. This has to be done before seccomp rules are applied,
as the parent and child must synchronise in order for the parent to
correctly set the configurations (and writes might be blocked by seccomp).

Signed-off-by: Aleksa Sarai <asarai@suse.com>
2016-01-12 10:06:35 +11:00
Aleksa Sarai a95483402e libcontainer: cgroups: loudly fail with Set
It is vital to loudly fail when a user attempts to set a cgroup limit
(rather than using the system default). Otherwise the user will assume
they have security they do not actually have. This mirrors the original
Apply() (that would set cgroup configs) semantics.

Signed-off-by: Aleksa Sarai <asarai@suse.com>
2016-01-12 10:06:35 +11:00
Aleksa Sarai f36ed4b174 libcontainer: cgroups: don't Set in Apply
Apply and Set are two separate operations, and it doesn't make sense to
group the two together (especially considering that the bootstrap
process is added to the cgroup as well). The only exception to this is
the memory cgroup, which requires the configuration to be set before
processes can join.

One of the weird cases to deal with is systemd. Systemd sets some of the
cgroup configuration options, but not all of them. Because memory is a
special case, we need to explicitly set memory in the systemd Apply().
Otherwise, the rest can be safely re-applied in .Set() as usual.

Signed-off-by: Aleksa Sarai <asarai@suse.com>
2016-01-12 10:06:35 +11:00
Aleksa Sarai db3159c9d9 libcontainer: cgroups: add pids controller support
Add support for the pids cgroup controller to libcontainer, a recent
feature that is available in Linux 4.3+.

Unfortunately, due to the init process being written in Go, it can spawn
an an unknown number of threads due to blocked syscalls. This results in
the init process being unable to run properly, and thus small pids.max
configs won't work properly.

Signed-off-by: Aleksa Sarai <asarai@suse.com>
2016-01-12 10:06:32 +11:00
Alexander Morozov 421ebfd688 Merge pull request #459 from crosbymichael/console-path
Add --console to specify path to use from runc
2016-01-11 14:13:05 -08:00
Alexander Morozov c0cad6aa5e Merge pull request #451 from cyphar/fix-infinite-recursion
cgroups: fs: fix cgroup.Parent path sanitisation
2016-01-11 08:52:26 -08:00
Mrunal Patel d43108184e Merge pull request #458 from hallyn/userns
Handle running nested in a user namespace
2016-01-11 08:41:46 -08:00
Aleksa Sarai bf899fef45 cgroups: fs: fix cgroup.Parent path sanitisation
Properly sanitise the --cgroup-parent path, to avoid potential issues
(as it starts creating directories and writing to files as root). In
addition, fix an infinite recursion due to incomplete base cases.

It might be a good idea to move pathClean to a separate library (which
deals with path safety concerns, so all of runC and Docker can take
advantage of it).

Signed-off-by: Aleksa Sarai <asarai@suse.com>
2016-01-11 23:10:35 +11:00
Alexander Morozov 910752f1f5 Merge pull request #463 from jimmidyson/non-recursive-pids
Revert to non-recursive GetPids, add recursive GetAllPids
2016-01-08 13:55:00 -08:00
Serge Hallyn c0ad40c5e6 Do not create devices when in user namespace
When we launch a container in a new user namespace, we cannot create
devices, so we bind mount the host's devices into place instead.

If we are running in a user namespace (i.e. nested in a container),
then we need to do the same thing.  Add a function to detect that
and check for it before doing mknod.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
---
 Changelog - add a comment clarifying what's going on with the
	     uidmap file.
2016-01-08 12:54:08 -08:00
Jimmi Dyson 91c7024e52 Revert to non-recursive GetPids, add recursive GetAllPids
Signed-off-by: Jimmi Dyson <jimmidyson@gmail.com>
2016-01-08 19:42:25 +00:00
Ahmet Alp Balkan c8b5e150f1 selinux: add SelinuxSetEnforceMode implementation
Signed-off-by: Ahmet Alp Balkan <ahmetalpbalkan@gmail.com>
2016-01-08 16:48:30 +00:00