From 1052a7205fce35455d3b75dbcfda81fdfe7836a7 Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Tue, 7 Jun 2016 13:06:27 -0600 Subject: [PATCH] Fix setting of hard stack limit when stack_hard is not specified in /etc/security/limits. When 64-bit resource limits are supported we can use the default value of 8388608 512-byte blocks directly. We should only resort to using RLIM_SAVED_MAX for 32-bit resource limits. --- lib/util/aix.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/util/aix.c b/lib/util/aix.c index 566e665bb..ef9d041cf 100644 --- a/lib/util/aix.c +++ b/lib/util/aix.c @@ -107,15 +107,21 @@ aix_setlimits(char *user) continue; rlim.rlim_cur = val == -1 ? RLIM64_INFINITY : (rlim64_t)val * aix_limits[n].factor; - /* Set hard limit per AIX /etc/security/limits documentation. */ + /* Set hard limit as per table in /etc/security/limits. */ switch (aix_limits[n].resource) { case RLIMIT_CPU: case RLIMIT_FSIZE: rlim.rlim_max = rlim.rlim_cur; break; case RLIMIT_STACK: +#ifdef HAVE_SETRLIMIT64 + rlim.rlim_max = 8388608ULL * aix_limits[n].factor; +#else rlim.rlim_max = RLIM_SAVED_MAX; +#endif break; + case RLIMIT_NOFILE: + rlim.rlim_max = 8196 * aix_limits[n].factor; default: rlim.rlim_max = RLIM64_INFINITY; break;