Commit Graph

2360 Commits

Author SHA1 Message Date
Michael Crosby 044e298507 Improve error handling in runc
The error handling on the runc cli is currenly pretty messy because
messages to the user are split between regular stderr format and logrus
message format.  This changes all the error reporting to the cli to only
output on stderr and exit(1) for consumers of the api.

By default logrus logs to /dev/null so that it is not seen by the user.
If the user wants extra and/or structured loggging/errors from runc they
can use the `--log` flag to provide a path to the file where they want
this information.  This allows a consistent behavior on the cli but
extra power and information when debugging with logs.

This also includes a change to enable the same logging information
inside the container's init by adding an init cli command that can share
the existing flags for all other runc commands.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2016-03-09 11:08:30 -08:00
Mrunal Patel 4155b68a24 Merge pull request #622 from rajasec/loadspec-return
Handling error condition in loadspec
2016-03-08 11:00:25 -08:00
Michael Crosby 54ff58036d Merge pull request #614 from mrunalp/man-pages
Add man pages
2016-03-08 10:55:03 -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
Michael Crosby 5baaa7653b Merge pull request #554 from duglin/AddTest
Add the most basic sniff tests of runc
2016-03-08 10:29:25 -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
Doug Davis 595f593c24 Add the most basic sniff tests of runc
just so that we're not merging code into master w/o any tests at all.
I expect this to be removed once we have a real testing infrastructure.

Signed-off-by: Doug Davis <dug@us.ibm.com>
2016-03-07 11:01:31 -08:00
Rajasekaran 335f63a282 Handling error condition in loadspec
Signed-off-by: Rajasekaran <rajasec79@gmail.com>
2016-03-06 09:22:26 +05:30
Mrunal Patel 208870ce18 Add README.md for generating man pages
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2016-03-04 11:14:12 -08:00
Mrunal Patel b41affd7b4 Update .gitignore for generate man pages
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2016-03-04 11:14:12 -08:00
Mrunal Patel d8482f3577 Add script to generate man pages from markdown
This is copied from docker

Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2016-03-04 11:14:12 -08:00
Mrunal Patel dffb1d232b Add man pages in markdown format
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2016-03-04 11:14: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
Alexander Morozov ad2c520c6e Merge pull request #606 from estesp/mount-perm-userns
Properly setuid/setgid after entering userns
2016-03-04 08:39:43 -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
Qiang Huang bb61de2734 Merge pull request #619 from crosbymichael/update-specs
Update specs dep and runc functionality
2016-03-04 20:25:43 +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
Michael Crosby aa9660027b Update spec version
This bump of the spec includes a change to the deivce type to be a
string so that it is more readable in the json serialization.

It also includes the change were caps, no new privs, and process
labeling features are moved from the container config onto the process.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2016-03-03 10:26:38 -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
Mrunal Patel 6403ea7481 Merge pull request #607 from codido/fix_unsupported_ns
Fix handling of unsupported namespaces
2016-03-02 10:37:02 -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 177f2c405c Merge pull request #605 from mikebrow/state-command
adds the spec required state command
2016-03-01 15:18:18 -05:00
Mike Brown 171e8f4818 adds the spec required state command
Signed-off-by: Mike Brown <brownwm@us.ibm.com>
2016-03-01 14:11:46 -06:00
Mrunal Patel af3c52c5b7 Merge pull request #603 from hqhq/hq_set_sysfs_ro
Set sysfs readonly in config
2016-03-01 11:15:19 -05:00
Qiang Huang 146643f1f9 Merge pull request #595 from crosbymichael/masking
Update masked and ro paths
2016-03-01 11:14:20 +08:00
Qiang Huang bbd97cc98e Set sysfs readonly in config
It is what we hard coded in runC, now we do it in config,
also removed the legacy function.

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
2016-03-01 10:23:08 +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
Michael Crosby c8aa84c004 Merge pull request #599 from hqhq/hq_add_maintainer
Add hqhq to MAINTAINERS
2016-02-29 10:54:43 -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
Mrunal Patel 8f7d5fe376 Merge pull request #590 from tonistiigi/fix-oomscoreadj
Fix setting OomScoreAdj from OCI spec
2016-02-28 21:52:21 -08:00
Qiang Huang aa319bf377 Add hqhq to MAINTAINER
Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
2016-02-29 08:41:35 +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