Re: [TRIVIAL] Re: setrlimit incorrectly allows hard limits to exceed soft limits

From: Rusty Russell (rusty@rustcorp.com.au)
Date: Sun Dec 08 2002 - 18:34:34 EST


In message <Pine.LNX.4.50L.0212061106050.22252-100000@duckman.distro.conectiva>
 you write:
> On Fri, 6 Dec 2002, Rusty Trivial Russell wrote:
>
> > > 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;
>
> Wouldn't it be better to simply take the soft limit down
> to min(new_rlim.rlim_cur, new_rlim.rlim_max) ?

POSIX says -EINVAL, and since it's a programmer fuckup, I'd agree.

Rusty.

--
  Anyone who quotes me in their sig is an idiot. -- Rusty Russell.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sun Dec 15 2002 - 22:00:13 EST