{ { "seccomp_policy", required_argument, NULL, 'P' }, "Path to file containing seccomp-bpf policy (see kafel/)" },
{ { "seccomp_string", required_argument, NULL, 0x0901 }, "String with kafel seccomp-bpf policy (see kafel/)" },
{ { "seccomp_log", no_argument, NULL, 0x0902 }, "Use SECCOMP_FILTER_FLAG_LOG. Log all actions except SECCOMP_RET_ALLOW). Supported since kernel version 4.14" },
+ { { "nice_level", required_argument, NULL, 0x0903 }, "Set jailed process niceness (-20 is highest -priority, 19 is lowest). By default, set to 19" },
{ { "cgroup_mem_max", required_argument, NULL, 0x0801 }, "Maximum number of bytes to use in the group (default: '0' - disabled)" },
{ { "cgroup_mem_mount", required_argument, NULL, 0x0802 }, "Location of memory cgroup FS (default: '/sys/fs/cgroup/memory')" },
{ { "cgroup_mem_parent", required_argument, NULL, 0x0803 }, "Which pre-existing memory cgroup to use as a parent (default: 'NSJAIL')" },
nsjconf->seccomp_fprog.filter = NULL;
nsjconf->seccomp_fprog.len = 0;
nsjconf->seccomp_log = false;
+ nsjconf->nice_level = 19;
nsjconf->openfds.push_back(STDIN_FILENO);
nsjconf->openfds.push_back(STDOUT_FILENO);
case 0x902:
nsjconf->seccomp_log = true;
break;
+ case 0x903:
+ nsjconf->nice_level = (int)strtol(optarg, NULL, 0);
+ if ((nsjconf->nice_level < -20) || (nsjconf->nice_level > -20)) {
+ LOG_W("Incorrect niceness setting!");
+ nsjconf->nice_level = 19;
+ }
+ break;
default:
cmdlineUsage(argv[0]);
return nullptr;
optional string macvlan_vs_gw = 78 [default = "192.168.0.1"];
optional string macvlan_vs_ma = 79 [default = ""];
+ /* Niceness level of the jailed process */
+ optional int32 nice_level = 80 [default = 19];
+
/* Binary path (with arguments) to be executed. If not specified here, it
can be specified with cmd-line as "-- /path/to/command arg1 arg2" */
- optional Exe exec_bin = 80;
+ optional Exe exec_bin = 81;
}
return false;
}
errno = 0;
- if (setpriority(PRIO_PROCESS, 0, 19) == -1 && errno != 0) {
- PLOG_W("setpriority(19)");
+ if (setpriority(PRIO_PROCESS, 0, nsjconf->nice_level) == -1 && errno != 0) {
+ PLOG_W("setpriority(%" PRId32 ")", nsjconf->nice_level);
}
if (!nsjconf->skip_setsid) {
setsid();