Commit Graph

528 Commits

Author SHA1 Message Date
Mrunal Patel 459efccb0a Merge pull request #576 from avagin/cr
Call Prestart hooks before restoring processes
2016-03-14 11:21:29 -07:00
Michael Crosby 8f206929b2 Ensure logs are flushed
This ensures that anything written to the logs are synced as they
happen.

This also changes the error message of the libcontainer error.  The
original idea was to have this extra information in the message but it
makes it hard to parse and if the caller needed this information they
can just get it from the error type.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2016-03-14 11:06:16 -07:00
rajasec d4be3405c7 Fixing valid-id in regex
Signed-off-by: rajasec <rajasec79@gmail.com>
2016-03-14 08:48:41 +05:30
Aleksa Sarai 64286b443d libcontainer: cgroups: add tests for pids.max in PidsStats
Signed-off-by: Aleksa Sarai <asarai@suse.de>
2016-03-13 14:16:38 +11:00
Aleksa Sarai 2b1e086f62 libcontainer: cgroups: add pids.max to PidsStats
In order to allow nice usage statistics (in terms of percentages and
other such data), add the value of pids.max to the PidsStats struct
returned from the pids cgroup controller.

Signed-off-by: Aleksa Sarai <asarai@suse.de>
2016-03-13 04:53:20 +11:00
Qiang Huang 2f2c83a2a0 Fix encoding gid mappings
Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
2016-03-12 13:18:42 +08:00
Tonis Tiigi 04da969aa8 Clear groups after entering userns
Clears supplementary groups that have effect on the
mount permissions before joining the user specified
groups happens.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2016-03-10 22:23:38 -08:00
Mrunal Patel 1beb2410db Merge pull request #633 from crosbymichael/bump-spec-v4
Bump spec v0.4
2016-03-10 16:42:46 -08:00
Michael Crosby 4bef923fdb Merge pull request #630 from crosbymichael/revert-exit-status
Revert "Return proper exit code for exec errors"
2016-03-10 14:42:30 -08:00
Michael Crosby 20422c9bd9 Update libcontainer to support rlimit per process
This updates runc and libcontainer to handle rlimits per process and set
them correctly for the container.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2016-03-10 14:35:16 -08:00
Andrey Vagin 080eac3d2a nsexec: don't use CLONE_PARENT and CLONE_NEWPID together
The rhel6 kernel returns EINVAL in this case

Known issue:
* CT with userns doesn't work

This is a copy of
d31e97fa28
to address https://github.com/opencontainers/runc/issues/613

Signed-off-by: Andrey Vagin <avagin@virtuozzo.com>
Signed-off-by: Andrew Fernandes <andrew@fernandes.org>
2016-03-10 14:28:10 -05:00
Michael Crosby 213c1a1a4a Revert "Return proper exit code for exec errors"
This reverts commit 6bb653a6e8.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2016-03-10 11:00:48 -08:00
Michael Crosby 3af08519d0 Merge pull request #616 from hqhq/hq_remove_dup_headfile
Remove duplicated included head file
2016-03-08 10:54:31 -08:00
Michael Crosby 8cc43a6c69 Merge pull request #618 from cloudfoundry-incubator/serialize-hooks
Serialize CommandHooks to state so that PostStop hooks execute during 'runc delete'
2016-03-08 10:51:54 -08:00
Mrunal Patel 5b439d8c48 Merge pull request #491 from hqhq/hq_cleanup_systemd_apply
Cleanup systemd apply
2016-03-08 08:32:02 -08:00
Mrunal Patel 7b6c4c418d Merge pull request #621 from estesp/remove-dead-code
Remove no longer used uid/gid mapping functions
2016-03-04 08:53:41 -08:00
Phil Estes 3cd0987dca Remove no longer used uid/gid mapping functions
Now that all the user namespace code is moved into C, these routines are
no longer used.

Docker-DCO-1.1-Signed-off-by: Phil Estes <estesp@linux.vnet.ibm.com> (github: estesp)
2016-03-04 11:21:34 -05:00
Phil Estes 178bad5e71 Properly setuid/setgid after entering userns
The re-work of namespace entering lost the setuid/setgid that was part
of the Go-routine based process exec in the prior code. A side issue was
found with setting oom_score_adj before execve() in a userns that is
also solved here.

Docker-DCO-1.1-Signed-off-by: Phil Estes <estesp@linux.vnet.ibm.com> (github: estesp)
2016-03-04 11:12:26 -05:00
Mrunal Patel a55b03e85a Merge pull request #620 from estesp/runinuserns-nonlinux
Stub RunningInUserNS for non-Linux
2016-03-04 07:17:38 -08:00
Phil Estes 009d2835cf Stub RunningInUserNS for non-Linux
Add a stub for non-Linux that always returns false

Docker-DCO-1.1-Signed-off-by: Phil Estes <estesp@linux.vnet.ibm.com> (github: estesp)
2016-03-03 16:33:43 -05:00
Michael Crosby 3cc90bd2d8 Add support for process overrides of settings
This commit adds support to libcontainer to allow caps, no new privs,
apparmor, and selinux process label to the process struct so that it can
be used together of override the base settings on the container config
per individual process.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2016-03-03 11:41:33 -08:00
Ed King b8d48474a9 Serialize CommandHooks to state
This is needed to make 'runc delete' correctly run the post-stop hooks.

Signed-off-by: Julian Friedman <julz.friedman@uk.ibm.com>
Signed-off-by: Ed King <eking@pivotal.io>
2016-03-03 16:57:51 +00:00
Qiang Huang 87e05b84e2 Remove duplicated included head file
Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
2016-03-03 11:08:18 +08:00
Mrunal Patel b86570a4d4 Merge pull request #610 from rajasec/checkpoint-state
Eliminating checkpoint state in container
2016-03-02 13:34:07 -08:00
Mrunal Patel 51fb686147 Merge pull request #609 from hustcat/centos6
Fix build error on centos6
2016-03-02 12:18:10 -08:00
Rajasekaran 0bda2c6af5 Eliminating checkpoint state in container
Signed-off-by: Rajasekaran <rajasec79@gmail.com>
2016-03-02 22:32:27 +05:30
Ido Yariv 78f5148c67 Fix handling of unsupported namespaces
currentState() always adds all possible namespaces to the state,
regardless of whether they are supported.
If orderNamespacePaths detects an unsupported namespace, an error is
returned that results in initialization failure.

Fix this by only adding paths of supported namespaces to the state.

Signed-off-by: Ido Yariv <ido@wizery.com>
2016-03-02 10:16:51 -05:00
Ye Yin 394fb55d85 Fix build error on centos6
Signed-off-by: Ye Yin <eyniy@qq.com>
2016-03-02 18:32:19 +08:00
Mrunal Patel b1872a068e Merge pull request #454 from mlaventure/libcontainer-pidns
Move setns within nsexec
2016-02-29 15:34:19 -08:00
Mrunal Patel 5f8fd8e04e Merge pull request #600 from duglin/FixTest
Fix to allow for build in different path
2016-02-29 11:01:31 -08:00
Mrunal Patel 6fc66fea48 Merge pull request #601 from LK4D4/fix_stats_race
Fix race between Apply and GetStats
2016-02-29 11:01:09 -08:00
Michael Crosby 5a701e9c13 Merge pull request #579 from rajasec/flagchange
Adding linux label to test file
2016-02-29 10:56:19 -08:00
Michael Crosby cda03a7ef1 Merge pull request #598 from rajasec/readme-swap
Updating swapiness value in README
2016-02-29 10:55:00 -08:00
Alexander Morozov e5906f7ed5 Fix race between Apply and GetStats
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
2016-02-29 08:50:42 -08:00
Doug Davis 3e46977ec1 Fix to allow for build in different path
The path in the stacktrace might not be:
  "github.com/opencontainers/runc/libcontainer/stacktrace"
For example, for me its:
  "_/go/src/github.com/opencontainers/runc/libcontainer/stacktrace"
so I changed the check to make sure the tail end of the path matches instead
of the entire thing

Signed-off-by: Doug Davis <dug@us.ibm.com>
2016-02-29 06:45:33 -08:00
Kenfe-Mickael Laventure 6325ab96e7 Call Prestart hook after namespaces have been set
This simply move the call to the Prestart hooks to be made once we
receive the procReady message from the client.

This is necessary as we had to move the setns calls within nsexec in
order to be accomodate joining namespaces that only affect future
children (e.g. NEWPID).

Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2016-02-28 12:26:53 -08:00
Kenfe-Mickael Laventure 08c3c6ebe2 Refactor nsexec
Cut nsexec in smaller chunk routines to make it more readable.

Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2016-02-28 12:26:53 -08:00
Daniel, Dao Quang Minh 002b6c2fe8 Reorder and remove unused imports in nsexec.c
Signed-off-by: Daniel, Dao Quang Minh <dqminh89@gmail.com>
2016-02-28 12:26:53 -08:00
Daniel, Dao Quang Minh 42d5d04801 Sets custom namespaces for init processes
An init process can join other namespaces (pidns, ipc etc.). This leverages
C code defined in nsenter package to spawn a process with correct namespaces
and clone if necessary.

This moves all setns and cloneflags related code to nsenter layer, which mean
that we dont use Go os/exec to create process with cloneflags and set
uid/gid_map or setgroups anymore. The necessary data is passed from Go to C
using a netlink binary-encoding format.

With this change, setns and init processes are almost the same, which brings
some opportunity for refactoring.

Signed-off-by: Daniel, Dao Quang Minh <dqminh89@gmail.com>
[mickael.laventure@docker.com: adapted to apply on master @ d97d5e]
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@docker.com>
2016-02-28 12:26:53 -08:00
Daniel, Dao Quang Minh d6bf4049f8 OrderNamespacePaths gets correct order of ns
This adds orderNamespacePaths to get correct order of namespaces for the
bootstrap program to join.

Signed-off-by: Daniel, Dao Quang Minh <dqminh89@gmail.com>
2016-02-28 12:26:53 -08:00
Daniel, Dao Quang Minh 2d32210620 Integration tests for joining namespaces
Signed-off-by: Daniel, Dao Quang Minh <dqminh89@gmail.com>
2016-02-28 12:26:53 -08:00
Daniel, Dao Quang Minh 4217b9c121 Do not override the specified userns path
Signed-off-by: Daniel, Dao Quang Minh <dqminh89@gmail.com>
2016-02-28 11:59:48 -08:00
Daniel, Dao Quang Minh f376cf84b9 Check if a namespace is supported
This adds `configs.IsNamespaceSupported(nsType)` to check if the host supports
a namespace type.

Signed-off-by: Daniel, Dao Quang Minh <dqminh89@gmail.com>
2016-02-28 11:59:48 -08:00
Alexander Morozov d282265f72 Merge pull request #596 from hushan/decoder_fix
Use single decoder instance for one stream
2016-02-27 16:27:57 -08:00
Mrunal Patel 64d87ebdec Merge pull request #585 from crosbymichael/dev-remountro
Remount /dev as ro after it is populated
2016-02-27 00:31:40 -08:00
Alexander Morozov 52fcc65943 Merge pull request #587 from crosbymichael/labels
Add bundle to runc list
2016-02-26 20:08:00 -08:00
Alexander Morozov 9ae2ed1051 Merge pull request #591 from crosbymichael/exec-errors
Return proper exit code for exec errors
2016-02-26 19:58:47 -08:00
Michael Crosby c5a34a6fe2 Allow extra mount types
This allows the mount syscall to validate the addiontal types where we
do not have to perform extra validation and is up to the consumer to
verify the functionality of the type of device they are trying to
mount.

Fixes #572

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2016-02-26 15:21:33 -08:00
Michael Crosby 6bb653a6e8 Return proper exit code for exec errors
Exec erros from the exec() syscall in the container's init should be
treated as if the container ran but couldn't execute the process for the
user instead of returning a libcontainer error as if it was an issue in
the library.

Before specifying different commands like `/etc`, `asldfkjasdlfj`, or
`/alsdjfkasdlfj` would always return 1 on the command line with a
libcontainer specific error message.  Now they return the correct
message and exit status defined for unix processes.

Example:

```bash
root@deathstar:/containers/redis# runc start test
exec: "/asdlfkjasldkfj": file does not exist
root@deathstar:/containers/redis# echo $?
127
root@deathstar:/containers/redis# runc start test
exec: "asdlfkjasldkfj": executable file not found in $PATH
root@deathstar:/containers/redis# echo $?
127
root@deathstar:/containers/redis# runc start test
exec: "/etc": permission denied
root@deathstar:/containers/redis# echo $?
126
```

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2016-02-26 11:41:56 -08:00
rajasec 05905ab0a6 Updating swapiness value in README
Signed-off-by: rajasec <rajasec79@gmail.com>
2016-02-26 22:53:28 +05:30
Hushan Jia 8597d5c969 Use single decoder instance for one stream
This will avoid part of the stream be read and abandomed
and resulting decoding errors.

Signed-off-by: Hushan Jia <hushan.jia@gmail.com>
2016-02-26 19:40:35 +08:00
Michael Crosby fc8c8ed9da Merge pull request #303 from mrunalp/sysctl_validation
Add validation for sysctl
2016-02-25 11:24:41 -08:00
rajasec 1db7322ded Removing pivot directory in defer
Signed-off-by: rajasec <rajasec79@gmail.com>

Changing to name values for defer as per review comments

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

Fixed review comments

Signed-off-by: rajasec <rajasec79@gmail.com>
2016-02-25 13:12:40 +05:30
Mrunal Patel 4951f5821b Merge pull request #582 from stefanberger/new_session_keyring
Create unique session key name for every container
2016-02-25 17:54:14 -08:00
rajasec 3b2805834b Adding linux label to test file
Signed-off-by: rajasec <rajasec79@gmail.com>

Fixed review comments

Signed-off-by: rajasec <rajasec79@gmail.com>
2016-02-25 07:52:32 +05:30
Michael Crosby e34b4fbcd3 Add labels to libconatiner config
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2016-02-24 10:45:20 -08:00
Alexander Morozov f94eb27013 Merge pull request #580 from estesp/swappiness-fix
Handle memory swappiness default properly
2016-02-24 10:33:50 -08:00
Phil Estes 0b5581fd28 Handle memory swappiness as a pointer to handle default/unset case
This prior fix to set "-1" explicitly was lost, and it is simpler to use
the same pointer type from the OCI spec to handle nil pointer == -1 ==
unset case.

Also, as a nearly humorous aside, there was a test for MemorySwappiness
that was actually setting Memory, and it was passing because of this
bug (as it was always setting everyone's MemorySwappiness to zero!)

Docker-DCO-1.1-Signed-off-by: Phil Estes <estesp@linux.vnet.ibm.com> (github: estesp)
2016-02-24 09:02:06 -06:00
Stefan Berger 5fbf791e31 Create unique session key name for every container
Create a unique session key name for every container. Use the pattern
_ses.<postfix> with postfix being the container's Id.

This patch does not prevent containers from joining each other's session
keyring.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2016-02-24 08:39:52 -05:00
rajasec 039d25c341 Added error check in Getfilecon
Signed-off-by: rajasec <rajasec79@gmail.com>

Fixed review comments

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

Fixed review comments for adding length check

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

Fixed review comment

Signed-off-by: rajasec <rajasec79@gmail.com>
2016-02-24 17:37:28 +05:30
Mrunal Patel 15b6b24413 Merge pull request #568 from mrunalp/move_hooks
Move pre-start hooks after container mounts
2016-02-24 10:07:32 +05:30
Michael Crosby fc98958321 Remount /dev as ro after it is populated
Because we more than likely control dev and populate devices and files
inside of it we need to make sure that we fulfil the user's request to
make it ro only after it has been populated.  This removes the need to
expose something like ReadonlyPaths in the config but still have the
same outcome but more seemless for the user.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2016-02-23 13:56:01 -08:00
Mrunal Patel 2f27649848 Move pre-start hooks after container mounts
Today mounts in pre-start hooks get overriden by the default mounts.
Moving the pre-start hooks to after the container mounts and before
the pivot/move root gives better flexiblity in the hooks.

Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2016-02-23 02:50:35 -08:00
Michael Crosby ee6a72df4e Merge pull request #577 from crosbymichael/m-named-cgroup
Move the process outside of the systemd cgroup
2016-02-19 13:51:58 -08:00
Michael Crosby 47f16e89df Move the process outside of the systemd cgroup
If you don't move the process out of the named cgroup for systemd then
systemd will try to delete all the cgroups that the process is currently
in.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2016-02-19 11:26:46 -08:00
Andrew Vagin b8121e8998 checkpoint: call Prestart hooks on restore before restoring processes
Docker uses Prestart hooks to call a libnetwork hook to create
network devices and set addesses and routes.

Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
2016-02-19 02:40:26 +03:00
Andrew Vagin 46c25be297 checkpoint: add support of the EmptyNs criu option
This options is set a namespace mask which will not be dumped and restored.
For example, we are going to use this option to restore network
for docker containers. CRIU will create a network namespace and
call a libnetwork hook to restore network devices, addresses and routes.

Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
2016-02-19 02:40:26 +03:00
Andrew Vagin a2a771b8e2 libcontainer: update criurpc.proto
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
2016-02-19 02:38:02 +03:00
Alexander Morozov 98cbce80fb Look for " - " instead of just - as separator
- symbol can appear in any path

Signed-off-by: Alexander Morozov <lk4d4@docker.com>
2016-02-18 09:58:29 -08:00
Mrunal Patel 2c489ce2d9 Merge pull request #564 from hallyn/2016-02-16/userns.devicecg
Do not set devices cgroup entries if in a user namespace
2016-02-17 09:25:24 +05:30
Serge Hallyn 655f8ea808 Do not set devices cgroup entries if in a user namespace
When in a non-initial user namespace you cannot update the devices
cgroup whitelist (or blacklist).  The kernel won't allow it.  So
detect that case and don't try.

This is a step to being able to run docker/runc containers inside a user
namespaced container.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2016-02-16 19:39:43 -08:00
Mrunal Patel d854d8fcc2 Merge pull request #553 from cyphar/fix-pids-limit-tests
libcontainer: integration: fix flaky pids limit tests
2016-02-17 08:36:05 +05:30
Mrunal Patel a86e44cf8f Merge pull request #556 from hqhq/hq_remove_unneeded_cleanup
Remove unneeded cgroups path removal
2016-02-17 08:31:35 +05:30
Alexander Morozov 533ee4d688 Merge pull request #557 from mrunalp/nonewprivs
Add support for NoNewPrivileges
2016-02-16 11:18:02 -08:00
Michael Crosby 4f33b03703 Merge pull request #561 from rajasec/kcore-link
Change softlink name to /dev/core
2016-02-16 11:03:37 -08:00
Michael Crosby 2b0a53b9a4 Merge pull request #552 from cyphar/fix-cgroup-path
libcontainer: cgroups: fs: fix innerPath
2016-02-16 10:41:44 -08:00
Alexander Morozov c6d18308b8 Merge pull request #526 from hqhq/hq_remove_procStart
Remove procStart
2016-02-16 09:12:04 -08:00
Mrunal Patel 38b39645d9 Implement NoNewPrivileges support in libcontainer
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2016-02-16 06:57:50 -08:00
Mrunal Patel 61bfcfd82a Add libcontainer configuration for NoNewPrivileges
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2016-02-16 03:59:43 -08:00
Chun Chen 2ee9cbbd12 It's /proc/stat, not /proc/stats
Also adds /proc/net/dev to the valid mount destination white list

Signed-off-by: Chun Chen <ramichen@tencent.com>
2016-02-16 15:59:27 +08:00
rajasec 4cd31f63c5 Change softlink name to /dev/core
Signed-off-by: rajasec <rajasec79@gmail.com>
2016-02-15 17:52:19 +05:30
Qiang Huang bda7742019 Cleanup systemd apply
Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
2016-02-15 15:56:59 +08:00
Qiang Huang 7b88f34d6e Remove unneeded cgroups path removal
It's handled in `destroy()`, no need to do this in
`Apply()`. I found this because systemd cgroup didn't
do this removal and it works well.

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
2016-02-15 11:22:13 +08:00
Aleksa Sarai 21dc85c4b8 libcontainer: cgroups: fs: add cgroup path safety unit tests
In order to avoid problems with security regressions going unnoticed,
add some unit tests that should make sure security regressions in cgroup
path safety cause tests to fail in runC.

Signed-off-by: Aleksa Sarai <asarai@suse.com>
2016-02-14 00:37:21 +11:00
Aleksa Sarai b8dc5213e8 libcontainer: cgroups: fs: fix path safety
Ensure that path safety is maintained, this essentially reapplies
c0cad6aa5e ("cgroups: fs: fix cgroup.Parent path sanitisation"), which
was accidentally removed in 256f3a8ebc ("Add support for CgroupsPath
field").

Signed-off-by: Aleksa Sarai <asarai@suse.com>
2016-02-14 00:37:21 +11:00
Aleksa Sarai 90140a5688 libcontainer: cgroups: fs: fix innerPath
Fix m.Path legacy code to actually work.

Signed-off-by: Aleksa Sarai <asarai@suse.com>
2016-02-14 00:37:21 +11:00
Aleksa Sarai 1f8711751e libcontainer: integration: fix flaky pids limit tests
Because we are implemented in Go, the number of pids present in a
container is not very well-defined (other than it not being /much/
bigger than the limit you'd want to set). As a result, we need to make
the tests a bit less flaky in this regard.

Signed-off-by: Aleksa Sarai <asarai@suse.com>
2016-02-12 00:14:22 +11:00
Alexander Morozov 4678b01e64 Merge pull request #497 from mlaventure/cgroups-path
Replace Cgroup Parent and Name fields by CgroupsPath
2016-02-10 13:00:49 -08:00
Kenfe-Mickael Laventure 256f3a8ebc Add support for CgroupsPath field
Fixes #396

Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2016-02-10 11:26:51 -08:00
Kenfe-Mickael Laventure dceeb0d0df Move pathClean to libcontainer/utils.CleanPath
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2016-02-09 16:21:58 -08:00
Alexander Morozov 8e8d01d38d Merge pull request #536 from crosbymichael/update-spec
Update spec to v0.3.0
2016-02-09 10:53:46 -08:00
rajasec 241e66dbe7 Adding pids subsystem in SPEC.md
Signed-off-by: rajasec <rajasec79@gmail.com>
2016-02-09 20:42:11 +05:30
Michael Crosby 3baae2d525 Update runc for devices changes
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2016-02-08 13:15:12 -08:00
rajasec f1cde33ed7 Fixing capabilities name in SPEC.md
Signed-off-by: rajasec <rajasec79@gmail.com>
2016-02-07 21:57:28 +05:30
Mike Brown c2c0458598 merges latest spec with runc
Signed-off-by: Mike Brown <brownwm@us.ibm.com>
2016-02-05 12:47:09 -08:00
Michael Crosby 9c9f8eeb4b Merge pull request #488 from stefanberger/new_session_keyring
Create a new session key for every container
2016-02-05 10:48:26 -08:00
Stefan Berger ad22e23aee Create a new session key for every container
Create a new session key ring '_ses' for every container. This avoids sharing
the key structure with the process that created the container and the
container inherits from.

This patch fixes it init and exec.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2016-02-04 22:05:50 -05:00
rajasec 298cd1b285 Added error string for process operations
Signed-off-by: rajasec <rajasec79@gmail.com>

Changing the error code string name as per review comments

Signed-off-by: rajasec <rajasec79@gmail.com>
2016-02-04 11:54:50 +05:30
Michael Crosby 5fe15a53b6 Merge pull request #496 from LK4D4/remove_sscanf
Remove usage of GetMounts from GetCgroupMounts
2016-02-04 14:55:41 -08:00
Michael Crosby 67cca27798 Merge pull request #529 from mlaventure/memory-limit-stat
Add limit value to memory stats
2016-02-04 11:21:35 -08:00
Qiang Huang d66c9632bf Merge pull request #524 from adfernandes/master
Add a compatibility header for CentOS/RHEL 6
2016-02-04 14:24:01 +08:00
Mrunal Patel 11a238b891 Merge pull request #522 from crosbymichael/created
Update list command and created methods
2016-02-04 09:47:10 +05:30
Kenfe-Mickael Laventure 7a12c92dbe Add limit value to memory stats
The value is populated with the content of `limit_in_bytes`.

Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2016-02-03 11:54:09 -08:00
Alexander Morozov 97146f4dc6 Remove usage of GetMounts from GetCgroupMounts
GetMounts is very cpu-expensive. I'll change other funcs in this package
to reuse code from GetCgroupMounts later.

Signed-off-by: Alexander Morozov <lk4d4@docker.com>
2016-02-01 11:00:23 -08:00
Qiang Huang 13e8f6e589 Remove procStart
It's never used and not needed. Our pipe is created with
syscall.SOCK_CLOEXEC, so pipe will be closed once container
process executed successfully, parent process will read EOF
and continue. If container process got error before executed,
we'll write procError to sync with parent.

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
2016-01-30 13:41:21 +08:00
Andrew Fernandes 3c2e77eed5 Add a compatibility header for CentOS/RHEL 6
Signed-off-by: Andrew Fernandes <andrew@fernandes.org>
2016-01-29 20:46:50 +00:00
Mrunal Patel 67aa3843e8 Merge pull request #474 from crosbymichael/detach
Add detach to runc
2016-01-28 14:09:07 -08:00
Michael Crosby 5cdb1be88f Merge pull request #517 from hqhq/hq_fix_comment
Fix the comment about sendConfig
2016-01-28 14:00:11 -08:00
Michael Crosby bb6a747825 Add detach to runc
By adding detach to runc the container process is the only thing running
on the system is the containers process.
This allows better usage of memeory and no runc process being long
lived.  With this addition you also need a delete command because the
detached container will not be able to remove state and the left over
cgroups directories.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2016-01-28 13:35:13 -08:00
Michael Crosby 1172a1e1e5 Update list command and created methods
We don't need a CreatedTime method on the container because it's not
part of the interface and can be received via the state.  We also do not
need to call it CreateTime because the type of this field is time.Time
so we know its time.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2016-01-28 13:32:24 -08:00
Michael Crosby 480e5f4416 Merge pull request #507 from mikebrow/runc-ls-command
adds list command
2016-01-28 13:20:07 -08:00
Mike Brown 4c871267db adds list command, and a timestamp in the container state
Signed-off-by: Mike Brown <brownwm@us.ibm.com>
2016-01-28 14:21:06 -06:00
Qiang Huang 064113363d Fix the comment about sendConfig
Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
2016-01-28 09:58:30 +08:00
Aleksa Sarai 57ba666ef3 cgroup: systemd: further systemd slice validation
Add some further (not critical, since Docker does this already)
validation to systemd slice names, to make sure users don't get cryptic
errors.

Signed-off-by: Aleksa Sarai <asarai@suse.com>
2016-01-27 19:00:52 +11:00
Michael Crosby 7cd384c0e5 Merge pull request #515 from crosbymichael/readall
Do not use stream encoders for pipe communication
2016-01-26 14:37:54 -08:00
Mrunal Patel 80c24730fa Merge pull request #511 from cyphar/fix-systemd-slice-expansion
cgroup: systemd: properly expand systemd slice names
2016-01-26 14:34:29 -08:00
Michael Crosby ddcee3cc2a Do not use stream encoders
Marshall the raw objects for the sync pipes so that no new line chars
are left behind in the pipe causing errors.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2016-01-26 11:22:05 -08:00
Alexander Morozov ee0a019448 Merge pull request #513 from duglin/RemoveNullState
Remove the nullState
2016-01-26 11:03:32 -08:00
Alexander Morozov 3268a1ea00 Merge pull request #499 from crosbymichael/state-fixes
Fix various state bugs for pause and destroy
2016-01-25 11:33:59 -08:00
Aleksa Sarai 8b32914065 cgroup: systemd: properly expand systemd slice names
Rather than using '/' to denote hierarchy in slice names, systemd uses
'-' in an odd way. This results in runC incorrectly assuming that
certain kernel features are missing (and using inconsistent paths for
the cgroups not supported by systemd), because the "subsystem path" used
is not the one that systemd has created. Fix all of this by properly
expanding slice names.

Signed-off-by: Aleksa Sarai <asarai@suse.com>
2016-01-25 23:18:34 +11:00
Doug Davis ff034a5119 Remove the nullState
Add a "createdState" in its place since I think that better describes
what its used for.

Signed-off-by: Doug Davis <dug@us.ibm.com>
2016-01-25 00:26:11 -08:00
Qiang Huang 045ada9be6 Revert "update date in README"
Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
2016-01-25 14:25:34 +08:00
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
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
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
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
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
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
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