Commit Graph

1811 Commits

Author SHA1 Message Date
Michael Crosby b3bb606513 Change mount dest after resolving symlinks
We need to update the mount's destination after we resolve symlinks so
that it properly creates and mounts the correct location.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2015-09-23 10:07:18 -07:00
keloyang 69a5b2df9e no need to use p.cmd.Process.Pid in function, use p.pid() instead.
Signed-off-by: keloyang <yangshukui@huawei.com>
2015-09-23 10:48:36 +08:00
Mrunal Patel d8b7deaf4c Merge pull request #283 from runcom/cleanup-unused-func-args
Cleanup unused func arguments
2015-09-22 16:53:19 -07:00
Mrunal Patel 7570169548 Merge pull request #288 from gitido/fix_userns
Enter existing user namespace if present
2015-09-22 16:27:57 -07:00
Mrunal Patel ec20263251 Merge pull request #289 from crosbymichael/stdio-null
Ignore changing /dev/null permissions if used in STDIO
2015-09-22 15:36:27 -07:00
Michael Crosby 219b6c99e0 Ignore changing /dev/null permissions if used in STDIO
Whenever dev/null is used as one of the main processes STDIO, do not try
to change the permissions on it via fchown because we should not do it
in the first place and also this will fail if the container is supposed
to be readonly.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2015-09-22 15:32:31 -07:00
Mrunal Patel ff122b864a Merge pull request #291 from runcom/test-dockerfile-criu-source
script: test_Dockerfile: install criu from source
2015-09-22 15:12:10 -07:00
Antonio Murdaca 9ff7b82f9b script: test_Dockerfile: install criu from source
Signed-off-by: Antonio Murdaca <runcom@linux.com>
2015-09-22 23:59:31 +02:00
Ido Yariv 08366a8597 Enter existing user namespace if present
When executing an additional process in a container, all namespaces are
entered but the user namespace. As a result, the process may be
executed as the host's root user. This has both functionality and
security implications.

Fix this by adding the missing user namespace to the array of
namespaces. Since joining a user namespace in which the caller is
already a member yields an error, skip namespaces we're already in.

Last, remove a needless and buggy AT_SYMLINK_NOFOLLOW in the code.

Signed-off-by: Ido Yariv <ido@wizery.com>
2015-09-21 21:49:52 -04:00
Michael Crosby 08b5415ffa Merge pull request #280 from crosbymichael/stdio-perms
Fix STDIO permissions when container user not root
2015-09-21 11:23:29 -07:00
Antonio Murdaca d6e6462478 Cleanup unused func arguments
Signed-off-by: Antonio Murdaca <runcom@linux.com>
2015-09-21 11:50:29 +02:00
Lai Jiangshan 7a54c7bd7b README.md: Update the config example
* version in the config example is advanced to 0.1.0
* rootfsPropagation in config.json is removed
    (The same one is already in runtime.json)
* rlimit time is changed from magic number to name(string)
* add pids cgroup
* add cgroup path

After this change applied, the example config in this README.md
is consistent with the result of `runc spec`.

Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
2015-09-19 08:46:55 +08:00
Michael Crosby 0dad64f7ad Fix STDIO permissions when container user not root
Fix the permissions of the container's main processes STDIO when the
process is not run as the root user.  This changes the permissions right
before switching to the specified user so that it's STDIO matches it's
UID and GID.

Add a test for checking that the STDIO of the process is owned by the
specified user.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2015-09-18 14:11:29 -07:00
Alexander Morozov 4198b43b18 Merge pull request #279 from crosbymichael/fix-stdio-ownership
Fix STDIO ownership for non-tty processes
2015-09-18 11:54:41 -07:00
Michael Crosby 4a91d2c6e7 Fix STDIO ownership for non-tty processes
When we are using user namespaces we need to make sure that when we do
not have a TTY we change the ownership of the pipe()'s used for the
process to the root user within the container so that when you call
open() on any of the /proc/self/fd/*'s you do not get an EPERM.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2015-09-18 11:35:23 -07:00
Alexander Morozov a0f4c39049 Merge pull request #278 from runcom/update-criu
script: test_Dockerfile: update criu version
2015-09-18 09:47:50 -07:00
Antonio Murdaca 8d38af2c33 script: test_Dockerfile: update criu version
Signed-off-by: Antonio Murdaca <runcom@linux.com>
2015-09-18 17:51:03 +02:00
Alexander Morozov cae6b31029 Merge pull request #264 from rhvgoyal/spec-allow-propgation-flags
libcontainer: Allow passing mount propagation flags
2015-09-17 15:02:17 -07:00
Mrunal Patel ef4ad24bb7 Merge pull request #269 from laijs/runc-start-usage
update the command usage for `runc start`
2015-09-17 08:39:28 -07:00
Lai Jiangshan 89aa41ee70 update the command usage for `runc start`
The patch mainly removes the wrong "for writing".
The config files are readonly when `runc start`.

Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
2015-09-17 10:33:20 +08:00
Vivek Goyal d1f4a5b8b5 libcontainer: Allow passing mount propagation flags
Right now if one passes a mount propagation flag in spec file, it
does not take effect. For example, try following in spec json file.

{
  "type": "bind",
  "source": "/root/mnt-source",
  "destination": "/root/mnt-dest",
  "options": "rbind,shared"
}

One would expect that /root/mnt-dest will be shared inside the container
but that's not the case.

#findmnt -o TARGET,PROPAGATION
`-/root/mnt-dest                      private

Reason being that propagation flags can't be passed in along with other
regular flags. They need to be passed in a separate call to mount syscall.
That too, one propagation flag at a time. (from mount man page).

Hence, store propagation flags separately in a slice and apply these
in that order after the mount call wherever appropriate. This allows
user to control the propagation property of mount point inside
the container.

Storing them separately also solves another problem where recursive flag
(syscall.MS_REC) can get mixed up. For example, options "rbind,private"
and "bind,rprivate" will be same and there will be no way to differentiate
between these if all the flags are stored in a single integer.

This patch would allow one to pass propagation flags "[r]shared,[r]slave,
[r]private,[r]unbindable" in spec file as per mount property.

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
2015-09-16 15:53:23 -04:00
Alexander Morozov dae4560ec2 Merge pull request #257 from mrunalp/cap_prefix
Add CAP prefix for capabilities
2015-09-16 11:39:39 -07:00
Mrunal Patel abb40ac3c7 Merge pull request #272 from laijs/close-config-file
close config file after loaded
2015-09-16 11:34:12 -07:00
Mrunal Patel 5a599a4c10 Merge pull request #268 from laijs/runc-usage
update the command usage of `runc`
2015-09-16 08:59:23 -07:00
Lai Jiangshan 8132f4d797 close config file after loaded
Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
2015-09-16 10:54:53 +08:00
Lai Jiangshan 66f152d6dd simple refactor for the options of `runc spec`
Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
2015-09-16 10:06:59 +08:00
Lai Jiangshan ac56948250 update the command usage of `runc`
Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
2015-09-16 09:49:06 +08:00
Mrunal Patel ec37110957 Update README for the CAP prefix change
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2015-09-15 14:44:12 -04:00
Mrunal Patel 859abee0c8 Add CAP prefix for capabilities
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2015-09-15 14:43:03 -04:00
Mrunal Patel 4ab132458f Merge pull request #242 from LK4D4/adjust_spec
Adjust runc to new opencontainers/specs version
2015-09-15 10:21:58 -07:00
Alexander Morozov ea5032bc5e Adjust runc to new opencontainers/specs version
I deleted possibility to specify config file from commands for now.
Until we decide how it'll be done. Also I changed runc spec interface to
write config files instead of output them.

Signed-off-by: Alexander Morozov <lk4d4@docker.com>
2015-09-15 08:35:25 -07:00
Mrunal Patel 07a2f4eaa5 Merge pull request #237 from hqhq/hq_add_testflags_docs
Add testing docs in README
2015-09-14 19:24:10 -07:00
Qiang Huang 088fd3f6df Add testing docs in README
Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
2015-09-15 08:30:28 +08:00
Mrunal Patel 4d8e13fc3e Merge pull request #43 from LK4D4/new_netlink
New netlink library
2015-09-14 14:01:07 -07:00
Mrunal Patel 1cf8ac8d6e Merge pull request #248 from rajasec/fixcheckpoint
Fixing checkpoint issue
2015-09-14 13:53:54 -07:00
Michael Crosby 6d2761d67e Merge pull request #251 from hqhq/hq_fix_comments
Minor comments fix
2015-09-14 13:44:19 -07:00
Mrunal Patel 486ac97618 Merge pull request #236 from hqhq/hq_fix_cgroup_rw
Always remount for bind mount
2015-09-14 12:08:34 -07:00
Michael Crosby c4780db6a5 Merge pull request #266 from rajasec/seccompfix
make localtest failure on removing seccomp flag in Makefile
2015-09-14 12:00:08 -07:00
Rajasekaran 2940f73a14 make localtest failure on removing seccomp flag
Signed-off-by: Rajasekaran <rajasec79@gmail.com>
2015-09-12 14:43:55 +05:30
Mrunal Patel ef9471fd5b Merge pull request #253 from avagin/cr-cgroups
c/r: create cgroups to restore a container
2015-09-11 18:03:40 -07:00
Mrunal Patel 8660fd2325 Merge pull request #265 from crosbymichael/tags
Add all support build tags for runc features
2015-09-11 12:16:37 -07:00
Michael Crosby 3200c16937 Add all support build tags for runc features
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2015-09-11 12:12:18 -07:00
Alexander Morozov b0fd9fb75a Merge pull request #220 from crosbymichael/build-tags
Add seccomp build tag
2015-09-11 12:06:27 -07:00
Michael Crosby a8e0185d97 Add seccomp build tag
Add a seccomp build tag and also support in the Makefile to add or
remove build tags.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2015-09-11 12:03:57 -07:00
Alexander Morozov 7d122ff30e Merge pull request #261 from crosbymichael/hooks
Implement hooks in libcontainer code base
2015-09-11 11:43:49 -07:00
David Calavera 0f28592b35 Turn hook pointers into values.
Signed-off-by: David Calavera <david.calavera@gmail.com>
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2015-09-11 11:34:34 -07:00
Michael Crosby dd969cbacd Add test for function based hooks
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2015-09-10 18:15:00 -07:00
Mrunal Patel 1dca365393 Add test for prestart hook
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>

Conflicts:
	libcontainer/integration/exec_test.go
2015-09-10 17:59:36 -07:00
Michael Crosby 05567f2c94 Implement hooks in libcontainer
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2015-09-10 17:57:31 -07:00
Mrunal Patel cd01b01018 Merge pull request #259 from hqhq/hq_fix_cgroup
Fix bug in find cgroup mount point dir
2015-09-10 12:01:22 -07:00