]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Add a resource limit for the total number of kqueues available to the
authorKonstantin Belousov <kib@FreeBSD.org>
Mon, 21 Oct 2013 16:44:53 +0000 (16:44 +0000)
committerKonstantin Belousov <kib@FreeBSD.org>
Mon, 21 Oct 2013 16:44:53 +0000 (16:44 +0000)
commit9110db818a1e36cffed5208b6d005d9c1b84236a
tree34a18ded32934f0a4679a54dd36c7f1f14b2d63d
parentce95d2f9228a2b4ff144a011ff315b0256277481
Add a resource limit for the total number of kqueues available to the
user.  Kqueue now saves the ucred of the allocating thread, to
correctly decrement the counter on close.

Under some specific and not real-world use scenario for kqueue, it is
possible for the kqueues to consume memory proportional to the square
of the number of the filedescriptors available to the process.  Limit
allows administrator to prevent the abuse.

This is kernel-mode side of the change, with the user-mode enabling
commit following.

Reported and tested by: pho
Discussed with: jmg
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
sys/kern/kern_event.c
sys/kern/kern_resource.c
sys/sys/eventvar.h
sys/sys/resource.h
sys/sys/resourcevar.h