From 85a0ddfd0b269f9527883973092c457f04c1af19 Mon Sep 17 00:00:00 2001 From: Konstantin Belousov Date: Mon, 21 Oct 2013 16:46:12 +0000 Subject: 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 --- lib/libutil/login_class.3 | 1 + lib/libutil/login_class.c | 1 + 2 files changed, 2 insertions(+) (limited to 'lib/libutil') diff --git a/lib/libutil/login_class.3 b/lib/libutil/login_class.3 index 62a65f20c799..75f361481c81 100644 --- a/lib/libutil/login_class.3 +++ b/lib/libutil/login_class.3 @@ -118,6 +118,7 @@ sbsize RLIMIT_SBSIZE vmemoryuse RLIMIT_VMEM pseudoterminals RLIMIT_NPTS swapuse RLIMIT_SWAP +kqueues RLIMIT_KQUEUES .Ed .It LOGIN_SETPRIORITY Set the scheduling priority for the current process based on the diff --git a/lib/libutil/login_class.c b/lib/libutil/login_class.c index 263044f446a9..39cce12f7f60 100644 --- a/lib/libutil/login_class.c +++ b/lib/libutil/login_class.c @@ -66,6 +66,7 @@ static struct login_res { { "vmemoryuse", login_getcapsize, RLIMIT_VMEM }, { "pseudoterminals", login_getcapnum, RLIMIT_NPTS }, { "swapuse", login_getcapsize, RLIMIT_SWAP }, + { "kqueues", login_getcapsize, RLIMIT_KQUEUES }, { NULL, 0, 0 } }; -- cgit v1.3 From 23f182d7fe1316a9feec7b69abea4dc0a9142bf1 Mon Sep 17 00:00:00 2001 From: Eitan Adler Date: Sun, 27 Oct 2013 04:49:40 +0000 Subject: All man pages refer to FreeBSD so there is no need to mention "In .Fx" --- lib/libutil/login.conf.5 | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'lib/libutil') diff --git a/lib/libutil/login.conf.5 b/lib/libutil/login.conf.5 index a07e1f03e0d3..04e8e88f0ee5 100644 --- a/lib/libutil/login.conf.5 +++ b/lib/libutil/login.conf.5 @@ -50,9 +50,7 @@ non-root user without a valid login class in A user with a uid of 0 without a valid login class will use the record "root" if it exists, or "default" if not. .Pp -In -.Fx , -users may individually create a file called +Users may individually create a file called .Pa .login_conf in their home directory using the same format, consisting of a single entry with a record id of "me". -- cgit v1.3 From efac066db1ea02b7fd6dcff8c19dbe5bd2793196 Mon Sep 17 00:00:00 2001 From: Eitan Adler Date: Sun, 27 Oct 2013 04:59:18 +0000 Subject: Mention in login.conf.5 which fields may be infinite and how to specifify infinity. The number of ways to indicate this confuses people. PR: docs/100196 Reported by: "Dr. Markus Waldeck" Reported by: Jamie Landeg Jones --- lib/libutil/login.conf.5 | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'lib/libutil') diff --git a/lib/libutil/login.conf.5 b/lib/libutil/login.conf.5 index 04e8e88f0ee5..e780940b7643 100644 --- a/lib/libutil/login.conf.5 +++ b/lib/libutil/login.conf.5 @@ -130,6 +130,7 @@ tag being delimited from the value by '=' instead of '#'). Whichever method is used, then all records in the database must use the same method to allow values to be correctly overridden in interpolated records. +A numeric value may be infinite. .It size A number which expresses a size. The default interpretation of a value is the number of bytes, but a @@ -148,6 +149,7 @@ represents terabytes. .El A size value is a numeric quantity and case of the suffix is not significant. Concatenated values are added together. +A size value may be infinite. .It time A period of time, by default in seconds. A prefix may specify a different unit: @@ -168,8 +170,16 @@ the number of seconds. Concatenated values are added together. For example, 2 hours and 40 minutes may be written either as 9600s, 160m or 2h40m. +A time value may be infinite. .El .Pp +.Dq infinity , +.Dq inf , +.Dq unlimited , +.Dq unlimit, +and -1 +are considered infinite values. +.Pp The usual convention to interpolate capability entries using the special .Em tc=value notation may be used. -- cgit v1.3 From 69b2d025a062756479586fc9379dbc5476f37258 Mon Sep 17 00:00:00 2001 From: Eitan Adler Date: Tue, 12 Nov 2013 00:56:22 +0000 Subject: Indicate that expand_number is case-insensitive. Reviewed by: -scsi --- lib/libutil/expand_number.3 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib/libutil') diff --git a/lib/libutil/expand_number.3 b/lib/libutil/expand_number.3 index f78223b0a9d0..2f5871f9bbfd 100644 --- a/lib/libutil/expand_number.3 +++ b/lib/libutil/expand_number.3 @@ -51,12 +51,13 @@ argument. The .Fn expand_number function +is case-insensitive and follows the SI power of two convention. .Pp The prefixes are: .Bl -column "Prefix" "Description" "1000000000000000000" -offset indent .It Sy "Prefix" Ta Sy "Description" Ta Sy "Multiplier" -.It Li k Ta No kilo Ta 1024 +.It Li K Ta No kilo Ta 1024 .It Li M Ta No mega Ta 1048576 .It Li G Ta No giga Ta 1073741824 .It Li T Ta No tera Ta 1099511627776 -- cgit v1.3 From 1748334408ed90b26897e509d0bc4a14d602f90c Mon Sep 17 00:00:00 2001 From: Eitan Adler Date: Thu, 13 Feb 2014 05:13:22 +0000 Subject: libutil/pw_util.3: Fix two prototypes. Reported by: marino Obtained from: DragonFlyBSD (e82b5d3dfa969bfcda5ffadceccc682b6bdcd077) MFC After: 3 days --- lib/libutil/pw_util.3 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/libutil') diff --git a/lib/libutil/pw_util.3 b/lib/libutil/pw_util.3 index 7ef0657b0b08..6c449ba069cb 100644 --- a/lib/libutil/pw_util.3 +++ b/lib/libutil/pw_util.3 @@ -48,13 +48,13 @@ .In pwd.h .In libutil.h .Ft int -.Fn pw_copy "int ffd" "int tfd" "const struct passwd *pw" "const struct passwd *oldpw" +.Fn pw_copy "int ffd" "int tfd" "const struct passwd *pw" "struct passwd *oldpw" .Ft "struct passwd *" .Fn pw_dup "const struct passwd *pw" .Ft int .Fn pw_edit "int nosetuid" .Ft int -.Fn pw_equal "const struct passwd *pw1" "const struct passwd pw2" +.Fn pw_equal "const struct passwd *pw1" "const struct passwd *pw2" .Ft void .Fn pw_fini "void" .Ft int -- cgit v1.3