rtprio, msgqueue - defaulting to 'soft'
authorEli Zrihen <ezrihen@gmail.com>
Tue, 20 Jul 2021 13:00:13 +0000 (16:00 +0300)
committerEli Zrihen <ezrihen@gmail.com>
Tue, 20 Jul 2021 13:00:13 +0000 (16:00 +0300)
cmdline.cc
config.proto

index 91a3662703f26f187800116a7b89a780684f2909..813f4b99746ebe6ae1acd6133b06f289342d393a 100644 (file)
@@ -110,8 +110,8 @@ struct custom_option custom_opts[] = {
     { { "rlimit_nproc", required_argument, NULL, 0x0206 }, "RLIMIT_NPROC, 'max' or 'hard' for the current hard limit, 'def' or 'soft' for the current soft limit, 'inf' for RLIM64_INFINITY (default: 'soft')" },
     { { "rlimit_stack", required_argument, NULL, 0x0207 }, "RLIMIT_STACK in MB, 'max' or 'hard' for the current hard limit, 'def' or 'soft' for the current soft limit, 'inf' for RLIM64_INFINITY (default: 'soft')" },
     { { "rlimit_memlock", required_argument, NULL, 0x0209 }, "RLIMIT_MEMLOCK in KB, 'max' or 'hard' for the current hard limit, 'def' or 'soft' for the current soft limit, 'inf' for RLIM64_INFINITY (default: 'soft')" },
-    { { "rlimit_rtprio", required_argument, NULL, 0x0210 }, "RLIMIT_RTPRIO, 'max' or 'hard' for the current hard limit, 'def' or 'soft' for the current soft limit, 'inf' for RLIM64_INFINITY (default: 0)" },
-    { { "rlimit_msgqueue", required_argument, NULL, 0x0211 }, "RLIMIT_MSGQUEUE in bytes, 'max' or 'hard' for the current hard limit, 'def' or 'soft' for the current soft limit, 'inf' for RLIM64_INFINITY (default: 128)" },
+    { { "rlimit_rtprio", required_argument, NULL, 0x0210 }, "RLIMIT_RTPRIO, 'max' or 'hard' for the current hard limit, 'def' or 'soft' for the current soft limit, 'inf' for RLIM64_INFINITY (default: 'soft')" },
+    { { "rlimit_msgqueue", required_argument, NULL, 0x0211 }, "RLIMIT_MSGQUEUE in bytes, 'max' or 'hard' for the current hard limit, 'def' or 'soft' for the current soft limit, 'inf' for RLIM64_INFINITY (default: 'soft')" },
     { { "disable_rlimits", no_argument, NULL, 0x0208 }, "Disable all rlimits, default to limits set by parent" },
     { { "persona_addr_compat_layout", no_argument, NULL, 0x0301 }, "personality(ADDR_COMPAT_LAYOUT)" },
     { { "persona_mmap_page_zero", no_argument, NULL, 0x0302 }, "personality(MMAP_PAGE_ZERO)" },
@@ -430,8 +430,8 @@ std::unique_ptr<nsjconf_t> parseArgs(int argc, char* argv[]) {
        nsjconf->rl_nproc = parseRLimit(RLIMIT_NPROC, "soft", 1);
        nsjconf->rl_stack = parseRLimit(RLIMIT_STACK, "soft", 1);
        nsjconf->rl_mlock = parseRLimit(RLIMIT_MEMLOCK, "soft", 1);
-       nsjconf->rl_rtpr = 0;
-       nsjconf->rl_msgq = 1024ULL;
+       nsjconf->rl_rtpr = parseRLimit(RLIMIT_RTPRIO, "soft", 1);
+       nsjconf->rl_msgq = parseRLimit(RLIMIT_MSGQUEUE, "soft", 1);
        nsjconf->disable_rl = false;
        nsjconf->personality = 0;
        nsjconf->clone_newnet = true;
index f803e09a4bb0997e08e27ffa39170bb28be15745..95bfa59e40d7f0ae4fe4a9799f9a5e2f29bd1c8b 100644 (file)
@@ -161,9 +161,9 @@ message NsJailConfig {
     optional uint64 rlimit_memlock = 88 [default = 64];
     optional RLimit rlimit_memlock_type = 89 [default = SOFT];
     optional uint64 rlimit_rtprio =  90 [default = 0];
-    optional RLimit rlimit_rtprio_type = 91 [default = VALUE];
-    optional uint64 rlimit_msgqueue =  92 [default = 1024];
-    optional RLimit rlimit_msgqueue_type = 93 [default = VALUE];
+    optional RLimit rlimit_rtprio_type = 91 [default = SOFT];
+    optional uint64 rlimit_msgqueue =  92 [default = 1024]; /* In bytes */
+    optional RLimit rlimit_msgqueue_type = 93 [default = SOFT];
 
     /* Disable all rlimits, default to limits set by parent */
     optional bool disable_rl = 84 [default = false];