lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.1.10.0901272243130.20262@alien.or.mcafeemobile.com>
Date:	Tue, 27 Jan 2009 22:57:41 -0800 (PST)
From:	Davide Libenzi <davidel@...ilserver.org>
To:	Greg KH <gregkh@...e.de>
cc:	Bron Gondwana <brong@...tmail.fm>,
	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
	stable@...nel.org, Justin Forbes <jmforbes@...uxtx.org>,
	Zwane Mwaikambo <zwane@....linux.org.uk>,
	Theodore Ts'o <tytso@....edu>,
	Randy Dunlap <rdunlap@...otime.net>,
	Dave Jones <davej@...hat.com>,
	Chuck Wolber <chuckw@...ntumlinux.com>
Subject: Re: [patch 016/104] epoll: introduce resource usage limits

On Tue, 27 Jan 2009, Davide Libenzi wrote:

> Or, like Willy said, make (for -stable) the default unlimited, and 
> let sysadmins to put the bounds if they feel the DoS can apply to them.

Whose patch follows ...


- Davide


---
 fs/eventpoll.c |   17 ++++-------------
 1 file changed, 4 insertions(+), 13 deletions(-)

Index: linux-2.6.mod/fs/eventpoll.c
===================================================================
--- linux-2.6.mod.orig/fs/eventpoll.c	2009-01-27 22:40:23.000000000 -0800
+++ linux-2.6.mod/fs/eventpoll.c	2009-01-27 22:52:41.000000000 -0800
@@ -220,9 +220,9 @@
  * Configuration options available inside /proc/sys/fs/epoll/
  */
 /* Maximum number of epoll devices, per user */
-static int max_user_instances __read_mostly;
+static int max_user_instances __read_mostly = INT_MAX;
 /* Maximum number of epoll watched descriptors, per user */
-static int max_user_watches __read_mostly;
+static int max_user_watches __read_mostly = INT_MAX;
 
 /*
  * This mutex is used to serialize ep_free() and eventpoll_release_file().
@@ -721,8 +721,7 @@
 
 	user = get_current_user();
 	error = -EMFILE;
-	if (unlikely(atomic_read(&user->epoll_devs) >=
-			max_user_instances))
+	if (atomic_read(&user->epoll_devs) >= max_user_instances)
 		goto free_uid;
 	error = -ENOMEM;
 	ep = kzalloc(sizeof(*ep), GFP_KERNEL);
@@ -897,8 +896,7 @@
 	struct epitem *epi;
 	struct ep_pqueue epq;
 
-	if (unlikely(atomic_read(&ep->user->epoll_watches) >=
-		     max_user_watches))
+	if (atomic_read(&ep->user->epoll_watches) >= max_user_watches)
 		return -ENOSPC;
 	if (!(epi = kmem_cache_alloc(epi_cache, GFP_KERNEL)))
 		return -ENOMEM;
@@ -1416,13 +1414,6 @@
 
 static int __init eventpoll_init(void)
 {
-	struct sysinfo si;
-
-	si_meminfo(&si);
-	max_user_instances = 128;
-	max_user_watches = (((si.totalram - si.totalhigh) / 32) << PAGE_SHIFT) /
-		EP_ITEM_COST;
-
 	/* Initialize the structure used to perform safe poll wait head wake ups */
 	ep_nested_calls_init(&poll_safewake_ncalls);
 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ