[Bug 71024] Re: ulimit / pam limits don't work
Samus Aran
71024 at bugs.launchpad.net
Mon Oct 22 23:47:18 UTC 2012
This bug still exists today. No way to limit RAM usage of apps, no
mention of this in the limits.conf example file which still has examples
for "rss".
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to pam in Ubuntu.
https://bugs.launchpad.net/bugs/71024
Title:
ulimit / pam limits don't work
Status in “pam” package in Ubuntu:
Fix Released
Bug description:
Memory limiting with pam/ulimit doesn't seem to be working in edgy.
E.g., add these 3 lines to /etc/security/limits.conf:
---8<-------------------------------------------------------------------
testuser hard rss 30700
testuser hard memlock 30700
testuser hard data 50900
--->8-------------------------------------------------------------------
Then login as testuser and allocate memory:
---8<-------------------------------------------------------------------
$ ulimit -d -l -m -v
data seg size (kbytes, -d) 50900
max locked memory (kbytes, -l) 30700
max memory size (kbytes, -m) 30700
virtual memory (kbytes, -v) unlimited
$ ./alloc 150 &
Allocating 150 MiB = 157286400 byte buffer...OK
Filling the buffer...OK
$ ps u 7525
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
testuser 7525 0.5 7.4 155052 154008 tty1 S 06:11 0:01 ./alloc 150
$
--->8-------------------------------------------------------------------
As you can see the RSS limit is 30700 KiB, yet 154008 KiB (i.e., more than 4 times the limit) was easily allocated.
The computer is an Athlon64 running in 32bit mode with 2 GiB of RAM and 1 GiB of swap, and "uname -a" says:
"Linux epox 2.6.17-10-generic #2 SMP Fri Oct 13 18:45:35 UTC 2006 i686 GNU/Linux"
(In case you're wondering, the alloc program does this: "uint8_t *buf;
buf=malloc(bytes); for (i=0; i<bytes; i++) buf[i]=(uint8_t)(i&0xff);"
plus some checks and printf():s and finally a pause().)
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/pam/+bug/71024/+subscriptions
More information about the foundations-bugs
mailing list