Commit Graph

96 Commits

Author SHA1 Message Date
Sebastiaan van Stijn
295e74008f
sys: remove custom setChildSubreaper const
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-05-04 08:43:57 +02:00
Haitao Li
35c14c6b56 sys/mount_linux: use pipe for communicating mount result
forkAndMountat forks a process to chdir then mount layers. Signals are
blocked (using runtime_beforeFork) during fork.

There is a race condition that the child process finishes before the
parent process is scheduled and can unblock signal handling. The SIGCHLD
signal sent from the finished process may have been delivered to the
shim process's reaper thread and caused the parent process fail with
ECHLD error.

This patch sets up a pipe for communication between child and parent
instead of waiting for child exit status.

Fixes #4009.

Signed-off-by: Haitao Li <hli@atlassian.com>
2020-04-09 09:50:41 +10:00
Phil Estes
0c78dacbc5
Move isFifo from process/io to sys/ and make public
Make "IsFifo" a public function for use by other parts of containerd
codebase.

Signed-off-by: Phil Estes <estesp@linux.vnet.ibm.com>
2020-03-25 10:44:17 -04:00
Sebastiaan van Stijn
6320236985
Partial revert of sys: windows: use golang.org/x/sys/windows
- preserve `syscall.ENOTDIR` to match os.MkDirAll
- change back parameter name to `adminAndLocalSystem`
- revert accidental change of permissions of parent-dir

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-03-09 16:01:09 +01:00
Michael Crosby
9ec579bf8a
Merge pull request #4093 from thaJeztah/replace_more_syscall
sys: windows: use golang.org/x/sys/windows
2020-03-09 10:47:23 -04:00
Sebastiaan van Stijn
0a7fd55f32
sys: deprecate EpollCreate1, EpollCtl, EpollWait
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-03-09 13:15:07 +01:00
Sebastiaan van Stijn
7b06192f61
sys: windows: use golang.org/x/sys/windows
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-03-09 13:05:53 +01:00
Sebastiaan van Stijn
f2edc6f164
vendor: update gotest.tools v3.0.2
full diff: https://github.com/gotestyourself/gotest.tools/compare/v2.3.0...v3.0.2

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-02-28 17:47:20 +01:00
Shengjing Zhu
35a8e6e589 sys: clean up process after test
Signed-off-by: Shengjing Zhu <zhsj@debian.org>
2020-01-15 22:03:39 +08:00
Akihiro Suda
62adc516dd sys: mkdirAs: do chown if dir already exists
Fix `buildkitd --group GROUP` issue when `/run/buildkit` already exists
and is owned by the root.

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2019-12-18 14:19:19 +09:00
Shukui Yang
21174cb497 Change bufferSize back to 32
Shim use non-blocking send now, there is no need to set bufferSize to 2048,
it's a waste.

Signed-off-by: Shukui Yang <keloyangsk@gmail.com>
2019-08-20 22:10:11 +08:00
Michael Crosby
2763639388 Try to preserve exit event order
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2019-08-19 14:23:12 +00:00
Michael Crosby
bee4c1a8a2 Add retry and non-blocking send for exit events
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2019-08-16 13:55:05 +00:00
Michael Crosby
0d27d8f4f2 Unifi reaper logic into package
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2019-08-16 13:55:05 +00:00
Michael Crosby
c93d645435 Add GetOOMScore function
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2019-04-09 10:40:54 -04:00
John Howard
6034c1950a Windows:Create root/state with ACL
Signed-off-by: John Howard <jhoward@microsoft.com>
2019-03-21 18:47:34 -07:00
zhangyue
996c60616a fix: fix error info start capitalized
Signed-off-by: zhangyue <zy675793960@yeah.net>
2018-11-28 15:26:16 +08:00
Claudia Beresford
32e6aa742b Fix teeny tiny typos
Signed-off-by: Claudia Beresford <cberesford@pivotal.io>
2018-09-05 14:44:44 +01:00
Wei Fu
67b54c6670 Support >= 128 layers in overlayfs snapshots
Auto-detect longest common dir in lowerdir option and compact it if the
option size is hitting one page size. If does, Use chdir + CLONE to do
mount thing to avoid hitting one page argument buffer in linux kernel
mount.

Signed-off-by: Wei Fu <fhfuwei@163.com>
2018-08-07 10:59:36 +08:00
Michael Crosby
da1b5470cd Runtime v2
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2018-07-17 10:21:29 -04:00
Vincent Demeester
832b05ae67
Update tests to use gotest.tools angel
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2018-06-08 21:02:01 +02:00
Claudia Beresford
544b985ff2 Don't fail on setting -ve oom score when rootless
This allows non-privileged users to use containerd.
If a non root user tried to set a negative oom score adjustment,
it will fail. Containerd should not fail if running rootless.

This is part of a larger track of work integrating containerd
into Cloudfoundry's garden with support for rootless.

[#156343443]

Signed-off-by: Danail Branekov <danailster@gmail.com>
2018-05-04 17:06:01 +01:00
Kenfe-Mickael Laventure
81feacd393
Fix typo in CreateUnixSocket error message
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2018-03-30 13:14:55 -07:00
Kenfe-Mickael Laventure
3c3a676490
Return a better error message is unix socket path is too long.
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2018-03-30 09:00:02 -07:00
Kunal Kushwaha
b12c3215a0 Licence header added
Signed-off-by: Kunal Kushwaha <kushwaha_kunal_v7@lab.ntt.co.jp>
2018-02-19 10:32:26 +09:00
Trevor Porter
d994d08664 Add time type conversion for 32bit Unix platforms
Ensures the time.Unix function is given int64 arguments

Signed-off-by: Trevor Porter <trkporter@ucdavis.edu>
2018-02-03 22:36:36 +00:00
Darren Stahl
e6280a7c82 Enable integration tests on Windows using snapshotter and differ
Signed-off-by: Darren Stahl <darst@microsoft.com>
2018-01-23 15:25:17 -08:00
Phil Estes
f47f6af585
Remove unnecessary subreaper API from sys/
Given these same exact functions are both now available in
opencontainers/runc (libcontainer/system) package, and we only use the
`SetSubreaper` today from the shim, there seems to be no reason for
duplication.

Signed-off-by: Phil Estes <estesp@linux.vnet.ibm.com>
2018-01-23 10:30:29 -05:00
Daniel Nephin
184bc25629 Add unconvert linter
This linter checks for unnecessary type convertions.

Some convertions are whitelisted because their type is different
on 32bit platforms

Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2018-01-09 17:36:44 -05:00
Daniel Nephin
f9e969bac8 Use gometalinter for linting
gometalinter runs linters in parallel for faster linting
it provides a uniform way of whitelisting lines using // nolint or the exclude
field in the config

Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2017-11-03 18:02:27 -04:00
Michael Crosby
1d298c89a4 Fix windows lint issues and enable ci
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-10-25 16:15:45 -04:00
Michael Crosby
b6e0c4f321 Fix go lint errors
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-10-25 15:26:44 -04:00
Michael Crosby
9956fa4b33 Remove solaris files
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-10-24 15:35:12 -04:00
Edward Pilatowicz
56c1f5c184 Add solaris build support
Signed-off-by: Edward Pilatowicz <edward.pilatowicz@oracle.com>
2017-08-07 12:40:21 -07:00
Tobias Klauser
bfa4b901a1 Use Prctl() and associated constants from x/sys/unix
Use unix.Prctl() instead of manually reimplementing it using
unix.RawSyscall. Also use unix.PR_SET_CHILD_SUBREAPER
unix.PR_GET_CHILD_SUBREAPER instead of locally defining them.

Also fix the package name form 'osutils' to 'sys' in the package level
comment.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2017-07-19 10:30:12 +02:00
Derek McGowan
528a9d87ac
Create socket parent directory with correct permissions
Often the socket is put into the directory /run/containerd.
When this directory does not exist, it gets created with the
default uid/gid and permission 0660. When the user has specified
a uid or gid, this should be used to set the ownership of that
parent directory and the permissions should be 0770. This worked
in a previous version of containerd but regressed after a refactor.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2017-07-17 13:08:02 -07:00
Lei Jitang
435f03d237 Remove C implementation of epoll on arm64
`"golang.org/x/sys/unix"` support epoll on arm64
with 324e137580
There is no need a C implementation of epoll on arm64.

Signed-off-by: Lei Jitang <leijitang@huawei.com>
2017-05-26 13:30:57 -04:00
Derek McGowan
4cb0839e41 Ensure grpc socket is group writable
Updates the filemode on the grpc socket to have group write
permission which is needed to perform GRPC. Additionally, ensure
the run directory has the specified group ownership and has group
read and enter permission.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2017-04-26 14:40:36 -07:00
Michael Crosby
634f0c0c83 Set oom score for containerd and shims
This adds a config option to set the oom score for the containerd daemon
as well as automatically setting the oom score for the shim's lauched so
that they are not killed until the very end of an out of memory
condition.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-04-12 11:34:32 -07:00
Michael Crosby
3db1ea8d07 [bin] Replace syscall with /x/sys/unix
Replace syscall usage with /sys/unix in the binaries and their packages

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-04-10 12:01:33 -07:00
Kenfe-Mickael Laventure
c5843b7615 Initial windows runtime work
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2017-04-07 09:20:44 -07:00
unclejack
d2a6630658 utils: remove utils & migrate code to sys
Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com>
2017-03-29 21:25:02 +03:00
Akihiro Suda
6089c1525b new package: compression (ported from docker/pkg/archive)
Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2017-03-16 05:29:27 +00:00
kevinetc123
6425680d94 use bitclear instead of seperating them and fix some typo
Signed-off-by: kevinetc123 <kaiwentan@harmonycloud.cn>
2017-02-09 17:30:21 +08:00
Michael Crosby
51510a8806 Move osutil to sys package
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2016-11-29 15:38:24 -08:00
Michael Crosby
789ff967c1 Move epoll to sys package
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2016-11-29 15:37:06 -08:00