Skip to content

Commit ee7b1ca

Browse files
Merge branch 'master' of https://github.com/google/nsjail
2 parents 73e2b5a + 9853352 commit ee7b1ca

2 files changed

Lines changed: 2 additions & 3 deletions

File tree

cpu.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include <sched.h>
2626
#include <stdint.h>
2727
#include <string.h>
28+
#include <sys/syscall.h>
2829
#include <unistd.h>
2930

3031
#include <memory>
@@ -127,7 +128,7 @@ bool initCpu(nsj_t* nsj) {
127128
(size_t)CPU_COUNT(new_mask.get()), available_cpus, (size_t)CPU_COUNT(orig_mask.get()),
128129
listCpusInSet(orig_mask.get()).c_str());
129130

130-
if (sched_setaffinity(0, CPU_ALLOC_SIZE(CPU_SETSIZE), new_mask.get()) == -1) {
131+
if (util::syscall(__NR_sched_setaffinity, 0, CPU_ALLOC_SIZE(CPU_SETSIZE), (uintptr_t)new_mask.get()) == -1) {
131132
PLOG_W("sched_setaffinity(mask=%s size=%zu max_cpus=%zu (CPU_COUNT=%zu)) failed",
132133
listCpusInSet(new_mask.get()).c_str(), (size_t)CPU_ALLOC_SIZE(CPU_SETSIZE),
133134
(size_t)nsj->njc.max_cpus(), (size_t)CPU_COUNT(new_mask.get()));

net.cc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -466,12 +466,10 @@ bool initParent(nsj_t* nsj, pid_t pid, int pipefd) {
466466

467467
for (const auto& iface : nsj->njc.iface_own()) {
468468
if (!moveToNs(iface, sk, link_cache, pid)) {
469-
nl_cache_free(link_cache);
470469
return false;
471470
}
472471
}
473472
if (!nsj->njc.macvlan_iface().empty() && !cloneIface(nsj, sk, link_cache, pid)) {
474-
nl_cache_free(link_cache);
475473
return false;
476474
}
477475

0 commit comments

Comments
 (0)