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.
This commit is contained in:
Todd C. Miller
2016-06-07 13:06:27 -06:00
parent 734b43c6b0
commit 1052a7205f

View File

@@ -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;