summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Fiddaman <andy@omniosce.org>2021-02-18 21:05:14 +0000
committerGitHub <noreply@github.com>2021-02-18 16:05:14 -0500
commit007468eb6c693b6d901ecd630b8f1909e41100bf (patch)
tree0ed024811a392b25efa1fdb243fce6ad87c6e65e
parentee3e97668a34268a4975e3ecd95c503a617fe1cc (diff)
downloadillumos-joyent-007468eb6c693b6d901ecd630b8f1909e41100bf.tar.gz
OS-8268 Incorrect RLIMIT_NPROC in lx causing some software to fail (#350)
Reviewed by: Jason King <jbk@joyent.com> Reviewed by: Mike Zeller <mike.zeller@joyent.com> Approved by: Dan McDonald <danmcd@joyent.com>
-rw-r--r--usr/src/uts/common/brand/lx/syscall/lx_rlimit.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/usr/src/uts/common/brand/lx/syscall/lx_rlimit.c b/usr/src/uts/common/brand/lx/syscall/lx_rlimit.c
index 30fa996615..eadc588824 100644
--- a/usr/src/uts/common/brand/lx/syscall/lx_rlimit.c
+++ b/usr/src/uts/common/brand/lx/syscall/lx_rlimit.c
@@ -11,6 +11,7 @@
/*
* Copyright 2017 Joyent, Inc.
+ * Copyright 2021 OmniOS Community Edition (OmniOSce) Association.
*/
#include <sys/systm.h>
@@ -20,6 +21,8 @@
#include <sys/cmn_err.h>
#include <sys/lx_impl.h>
#include <sys/lx_brand.h>
+#include <sys/sysmacros.h>
+#include <sys/var.h>
#define LX_RLIMIT_CPU 0
#define LX_RLIMIT_FSIZE 1
@@ -166,8 +169,15 @@ lx_getrlimit_common(int lx_resource, uint64_t *rlim_curp, uint64_t *rlim_maxp)
break;
case LX_RLIMIT_NPROC:
- /* zone.max-lwps */
- rlim64.rlim_cur = rlim64.rlim_max = curzone->zone_nlwps_ctl;
+ /*
+ * This is a limit on the number of processes for a
+ * real user ID (not enforced for privileged processes).
+ *
+ * This is analogous to v.v_maxup but is further capped
+ * by zone.max-processes
+ */
+ rlim64.rlim_cur = rlim64.rlim_max =
+ MIN(v.v_maxup, curzone->zone_nprocs_ctl);
break;
case LX_RLIMIT_MEMLOCK:
@@ -415,7 +425,7 @@ lx_setrlimit_common(int lx_resource, uint64_t rlim_cur, uint64_t rlim_max)
case LX_RLIMIT_NPROC:
/*
- * zone.max-lwps
+ * zone.max-processes
* Since we're emulating the value via a zone rctl, we can't
* set that from within the zone. Lie and say we set the value.
*/