From: Karel Zak Date: Thu, 14 Oct 2021 08:28:59 +0000 (+0200) Subject: su: reset RLIMIT_AS too X-Git-Tag: v2.38-rc1~227 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=be3acd23a8ec4701356a7e1db123b73237069764;p=thirdparty%2Futil-linux.git su: reset RLIMIT_AS too Fixes: https://github.com/karelzak/util-linux/issues/1465 Signed-off-by: Karel Zak --- diff --git a/login-utils/runuser.1.adoc b/login-utils/runuser.1.adoc index f2ca6fc326..fdce60300e 100644 --- a/login-utils/runuser.1.adoc +++ b/login-utils/runuser.1.adoc @@ -28,7 +28,7 @@ For backward compatibility, *runuser* defaults to not changing the current direc Note that *runuser* in all cases use PAM (pam_getenvlist()) to do the final environment modification. Command-line options such as *--login* and *--preserve-environment* affect the environment before it is modified by PAM. -Since version 2.38 *runuser* resets process resource limits RLIMIT_NICE and RLIMIT_RTPRIO to zero. +Since version 2.38 *runuser* resets process resource limits RLIMIT_NICE, RLIMIT_RTPRIO, RLIMIT_FSIZE, RLIMIT_AS and RLIMIT_NOFILE. == OPTIONS diff --git a/login-utils/su-common.c b/login-utils/su-common.c index 02687892ce..6b7ddeca75 100644 --- a/login-utils/su-common.c +++ b/login-utils/su-common.c @@ -973,6 +973,7 @@ static void sanitize_prlimits(void) lm.rlim_cur = RLIM_INFINITY; lm.rlim_max = RLIM_INFINITY; setrlimit(RLIMIT_FSIZE, &lm); + setrlimit(RLIMIT_AS, &lm); /* reset soft limit only */ getrlimit(RLIMIT_NOFILE, &lm); diff --git a/login-utils/su.1.adoc b/login-utils/su.1.adoc index 9c9f772715..b06adf948c 100644 --- a/login-utils/su.1.adoc +++ b/login-utils/su.1.adoc @@ -29,7 +29,7 @@ This version of *su* uses PAM for authentication, account and session management Note that *su* in all cases uses PAM (*pam_getenvlist*(3)) to do the final environment modification. Command-line options such as *--login* and *--preserve-environment* affect the environment before it is modified by PAM. -Since version 2.38 *su* resets process resource limits RLIMIT_NICE, RLIMIT_RTPRIO, RLIMIT_FSIZE and RLIMIT_NOFILE. +Since version 2.38 *su* resets process resource limits RLIMIT_NICE, RLIMIT_RTPRIO, RLIMIT_FSIZE, RLIMIT_AS and RLIMIT_NOFILE. == OPTIONS