Re: crash by high values in /proc/sys/net/core/[rw]mem_*

Stefan Traby (stefan@sime.com)
Thu, 4 Feb 1999 02:49:01 +0100


Hi Andi, Rick !

On Wed, Feb 03, 1999 at 07:19:01PM +0100, Andi Kleen wrote:
> In article <19990203173256.B613@stefan.sime.com>,
> stefan@sime.com (Stefan Traby) writes:
> > Hi !
> > Linux 2.2.1 oopses after putting (silly) high values
> > into /proc/sys/net/core/[rw]mem_{default,max}.
>
> Linux 2.2 doesn't have per-user in-core memory limiting, although
> the basic infrastructure for it is there.
>
> Currently: don't do such stupid things as root.

According to my calculations my crash was *impossible*.
The values where high, but well calculated. The real stupid thing is in the
kernel.

I found the problem (in net/core/sock.c, SNDBUF-ioctl). The crash
occured because the system uses up to 2*sysctl_rmem_max.

---
if (val > sysctl_wmem_max)
val = sysctl_wmem_max;

sk->sndbuf = max(val*2,2048);
---

rmem_default = wmem_default = 64KB
rmem_max = wmem_max = 1MB

setsockopt(5, SOL_SOCKET, SO_SNDBUF, [1048576], 4) = 0
setsockopt(5, SOL_SOCKET, SO_RCVBUF, [1048576], 4) = 0
read(5, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 12338976) = 2009568

I really accept that SO_RCVBUF is a hint.
But I expect that sysctl_rmem_max is a hard limit that I can count on.
Somebody should really fix this or give me a good reason why that thing is
called *max.
Additional to the fix it would be to incrase the default values to 128KB
(because its the actual behavior).

-- 
  ciao - 
    Stefan

Stefan Traby phone: +43-3133-6107-2 Mitterlasznitzstr. 13 fax: +43-3133-6107-9 8302 Nestelbach mailto://stefan@sime.com Austria

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/