setrlimit incorrectly allows hard limits to exceed soft limits
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Rik" == Rik van Riel <[email protected]> writes:
Quoted 5 lines · Rusty Trivial Russell
Quoted 5 lines
Quoted 1 line
Just try "ulimit -H -m 10000" for memory limits that were not >
previously set. You end up with (hard limit = 10000) < (soft limit = > unlimited).
+ if (new_rlim.rlim_cur > new_rlim.rlim_max) + return
-EINVAL;
Rik> Wouldn't it be better to simply take the soft limit down to Rik> min(new_rlim.rlim_cur, new_rlim.rlim_max) ?
Single unix spec says to return EINVAL in this case.
[EINVAL]
An invalid resource was specified; or in a setrlimit() call, the new rlim_cur exceeds the new rlim_max.
Quoted 8 lines · Peter Chubb
Rik> Wouldn't it be better to simply take the soft limit down to Rik>
min(new_rlim.rlim_cur, new_rlim.rlim_max)?Single unix spec says to return EINVAL in this case.
[EINVAL]
An invalid resource was specified; or in asetrlimit()call, the newrlim_curexceeds the newrlim_max.
So how about "the old rlim_cur exceeds the new rlim_max" ? ;)
Rik
Signature · 3 lines
Bravely reimplemented by the knights who say "NIH". http://www.surriel.com/ http://guru.conectiva.com/ Current spamtrap: <a href=mailto:"[email protected]">[email protected]</a>
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Rik" == Rik van Riel <[email protected]> writes:
Rik> On Mon, 9 Dec 2002, Peter Chubb wrote: Wouldn't it be better to Rik> simply take the soft limit down to min(new_rlim.rlim_cur, Rik> new_rlim.rlim_max) ?
Quoted 4 lines
Quoted 4 lines
Single unix spec says to return EINVAL in this case.
[EINVAL] An invalid resource was specified; or in a
setrlimit()call, the newrlim_curexceeds the newrlim_max.
Rik> So how about "the old rlim_cur exceeds the new rlim_max" ? ;)
You always have to set both, so the old value is irrelevant, except in so far as rlim_max may not be increased except by a privileged process.
setrlimit may return EINVAL if the actual usage is above the new rlim_cur.
--
Dr Peter Chubb [email protected]
You are lost in a maze of BitKeeper repositories, all almost the same.
Quoted 1 line · Peter Chubb
You always have to set both,
Duh, forgot about that. Nevermind.
Rik
Signature · 3 lines
Bravely reimplemented by the knights who say "NIH". http://www.surriel.com/ http://guru.conectiva.com/ Current spamtrap: <a href=mailto:"[email protected]">[email protected]</a>