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>
- 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>
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>
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>
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>
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>
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>
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>
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>
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>
`"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>
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>
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>