Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions contain.cc
Original file line number Diff line number Diff line change
Expand Up @@ -260,8 +260,21 @@ static bool containSetLimits(nsj_t* nsj) {
rl.rlim_cur = rl.rlim_max = config::adjustRLimit(
RLIMIT_MSGQUEUE, nsj->njc.rlimit_msgqueue_type(), nsj->njc.rlimit_msgqueue());
if (util::setrlimit(RLIMIT_MSGQUEUE, rl) == -1) {
PLOG_E("util::setrlimit(0, RLIMIT_MSGQUEUE , %" PRIu64 ")", rl.rlim_cur);
return false;
/*
* Some kernels (e.g. gVisor) refuse RLIMIT_MSGQUEUE altogether. That is harmless when
* the limit already has the requested value, which is the case for the default 'soft'.
*/
const int saved_errno = errno;
struct rlimit64 cur;
if (saved_errno != EPERM || util::getrlimit(RLIMIT_MSGQUEUE, &cur) == -1 ||
cur.rlim_cur != rl.rlim_cur || cur.rlim_max != rl.rlim_max) {
errno = saved_errno;
PLOG_E("util::setrlimit(0, RLIMIT_MSGQUEUE , %" PRIu64 ")", rl.rlim_cur);
return false;
}
LOG_W("util::setrlimit(0, RLIMIT_MSGQUEUE , %" PRIu64
") failed with EPERM, but the limit already has that value",
rl.rlim_cur);
}
return true;
}
Expand Down
5 changes: 5 additions & 0 deletions net.cc
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,11 @@ bool initParent(nsj_t* nsj, pid_t pid, int pipefd) {
init_success = true;
return true;
}
/* The link cache below is only needed to move or clone an interface into the jail */
if (nsj->njc.iface_own().empty() && nsj->njc.macvlan_iface().empty()) {
init_success = true;
return true;
}
#ifdef HAVE_LIBNL3
struct nl_sock* sk = nl_socket_alloc();
if (!sk) {
Expand Down
Loading