Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 30 Oct 2013 14:01:57 +0100
From:      Stefan Neudorf <BM-2cXppXU4T67w7j6NCir9T1WdzBHmFgBnLj@bitmessage.ch>
To:        Konstantin Belousov <kib@FreeBSD.org>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org
Subject:   Re: svn commit: r256850 - in head: bin/sh etc lib/libc/sys lib/libutil usr.bin/limits usr.bin/procstat
Message-ID:  <20131030.86fvriud2y@bitmessage.ch>
In-Reply-To: <201310211646.r9LGkDl5012906@svn.freebsd.org> (Konstantin Belousov's message of "Mon, 21 Oct 2013 16:46:13 %2B0000 (UTC)")
References:  <201310211646.r9LGkDl5012906@svn.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Konstantin Belousov <kib@FreeBSD.org> writes:

> Author: kib
> Date: Mon Oct 21 16:46:12 2013
> New Revision: 256850
> URL: http://svnweb.freebsd.org/changeset/base/256850
>
> Log:
>   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
>
> Modified:
>   head/bin/sh/miscbltin.c
>   head/etc/login.conf
>   head/lib/libc/sys/getrlimit.2
>   head/lib/libutil/login_class.3
>   head/lib/libutil/login_class.c
>   head/usr.bin/limits/limits.c
>   head/usr.bin/procstat/procstat_rlimit.c

kqueues limit isn't documented in sh(1) and limits(1) manpages.

>
> Modified: head/bin/sh/miscbltin.c
> ==============================================================================
> --- head/bin/sh/miscbltin.c	Mon Oct 21 16:44:53 2013	(r256849)
> +++ head/bin/sh/miscbltin.c	Mon Oct 21 16:46:12 2013	(r256850)
> @@ -405,6 +405,9 @@ static const struct limits limits[] = {
>  #ifdef RLIMIT_NPTS
>  	{ "pseudo-terminals",	(char *)0,	RLIMIT_NPTS,	   1, 'p' },
>  #endif
> +#ifdef RLIMIT_KQUEUES
> +	{ "kqueues",		(char *)0,	RLIMIT_KQUEUES,	   1, 'k' },
> +#endif
>  	{ (char *) 0,		(char *)0,	0,		   0, '\0' }
>  };
>  

I've submitted a patch to add ulimit -k (kqueue) to zsh but the reviewer
asked me to rename -k to -K to avoid conflict with ulimit -k (posixlocks)
from DragonFly. Do you anticipate FreeBSD never adds RLIMIT_POSIXLOCKS
support or would use incompatible option switch?

http://www.zsh.org/mla/workers/2013/msg00984.html
http://gitweb.dragonflybsd.org/dragonfly.git?a=search&h=HEAD&st=commit&s=posixlocks

> Modified: head/usr.bin/limits/limits.c
> ==============================================================================
> --- head/usr.bin/limits/limits.c	Mon Oct 21 16:44:53 2013	(r256849)
> +++ head/usr.bin/limits/limits.c	Mon Oct 21 16:46:12 2013	(r256850)

This adds limits -e support only for sh, csh, tcsh. What about other
shells that already support sbsize and swapuse extensions?




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20131030.86fvriud2y>