Subject: kern/7510: sysctl -w kern.maxfiles=8192 is somewhat useless
To: None <gnats-bugs@gnats.netbsd.org>
From: Michael Graff <explorer@flame.org>
List: netbsd-bugs
Date: 05/02/1999 16:22:25
>Number:         7510
>Category:       kern
>Synopsis:       sysctl -w kern.maxfiles=8192 is somewhat useless
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people (Kernel Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun May  2 16:05:01 1999
>Last-Modified:
>Originator:     Michael Graff
>Organization:
flame.org:  yes, we do know everything
>Release:        current
>Environment:
	
System: NetBSD kechara.flame.org 1.4_BETA NetBSD 1.4_BETA (KECHARA) #0: Wed Apr 28 19:59:58 PDT 1999 explorer@kechara.flame.org:/raid0/OS/NetBSD/src-1-4/sys/arch/i386/compile/KECHARA i386


>Description:
While one can use
	sysctl -w kern.maxfiles=8192
to increase the number of descriptors available to the kernel, it is
more or less useless, as it doesn't allow a single process to use more
than the boot-time maximum.
>How-To-Repeat:
frankenstein# sysctl -w kern.maxfiles=4096
kern.maxfiles: 1772 -> 4096
frankenstein# limit
cputime         unlimited
filesize        unlimited
datasize        1048576 kbytes
stacksize       32768 kbytes
coredumpsize    unlimited
memoryuse       57896 kbytes
descriptors     1772 
memorylocked    57896 kbytes
maxproc         532 
frankenstein# unlimit descriptors
frankenstein# limit
cputime         unlimited
filesize        unlimited
datasize        1048576 kbytes
stacksize       32768 kbytes
coredumpsize    unlimited
memoryuse       57896 kbytes
descriptors     1772 
memorylocked    57896 kbytes
maxproc         532 


>Fix:
No idea, but the problem is that rlim_max is checked for, and I have a
feeling that this is copied from the parent, which is ultimately
proc0.  Perhaps root should be allowed to bypass this check, and check
against the system maximum?  That's not right either, though, since I
might want to limit what a given root-runnign process is limited to.

--Michael

>Audit-Trail:
>Unformatted: