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>] [day] [month] [year] [list]
Date:	Fri, 1 Mar 2013 18:32:08 -0500
From:	Andrew Shewmaker <agshew@...il.com>
To:	akpm@...ux-foundation.org
Cc:	linux-mm@...ck.org, linux-kernel@...r.kernel.org,
	alan@...rguk.ukuu.org.uk, simon.jeons@...il.com,
	ric.masonn@...il.com
Subject: [PATCH v3 001/002] mm: limit growth of 3% hardcoded other user
 reserve

Limit the growth of the memory reserved for other processes
to the smaller of 3% or 2000 pages.

This affects OVERCOMMIT_NEVER mode.

Signed-off-by: Andrew Shewmaker <agshew@...il.com>

---

I had simply removed the reserve previously, but that caused forks 
to fail easily. This allows a user to recover similar to the 
simple 3% reserve, but allows a single process to allocate more 
memory.

Alan suggested the min(3%, k), and I've k=2000 pages seems to work well.
It allows enough free pages to for sshd, bash, and top, in case some 
sort of recovery is necessary. Of course, memory will still be exhausted 
eventually.

diff --git a/mm/mmap.c b/mm/mmap.c
index d1e4124..6134b1d 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -183,9 +183,10 @@ int __vm_enough_memory(struct mm_struct *mm, long pages, int cap_sys_admin)
 	allowed += total_swap_pages;
 
 	/* Don't let a single process grow too big:
-	   leave 3% of the size of this process for other processes */
+	 * leave the smaller of 3% of the size of this process 
+         * or 2000 pages for other processes */
 	if (mm)
-		allowed -= mm->total_vm / 32;
+		allowed -= min(mm->total_vm / 32, 2000UL);
 
 	if (percpu_counter_read_positive(&vm_committed_as) < allowed)
 		return 0;
--
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