public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [Patch] 'sysctl_max_map_count' should be non-negative
@ 2009-11-30  4:59 Amerigo Wang
  0 siblings, 0 replies; only message in thread
From: Amerigo Wang @ 2009-11-30  4:59 UTC (permalink / raw)
  To: linux-kernel
  Cc: Jan Engelhardt, Alexey Dobriyan, Peter Zijlstra, Amerigo Wang,
	James Morris, akpm, stable, Ingo Molnar


Jan Engelhardt reported we have this problem:

setting max_map_count to a value large enough results in programs dying
at first try.
This is on 2.6.31.6.

15:59 borg:/proc/sys/vm # echo $[1<<31-1] >max_map_count
15:59 borg:/proc/sys/vm # cat max_map_count
1073741824
15:59 borg:/proc/sys/vm # echo $[1<<31] >max_map_count
15:59 borg:/proc/sys/vm # cat max_map_count
Killed


This is because we have a chance to make 'max_map_count' negative.
but it's meaningless. Make it only accept non-negative values.

Reported-by: Jan Engelhardt <jengelh@medozas.de>
Signed-off-by: WANG Cong <amwang@redhat.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: James Morris <jmorris@namei.org>
Cc: Alexey Dobriyan <adobriyan@gmail.com>
Cc: stable@kernel.org

---
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 0d949c5..212360e 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -1245,7 +1245,8 @@ static struct ctl_table vm_table[] = {
 		.data		= &sysctl_max_map_count,
 		.maxlen		= sizeof(sysctl_max_map_count),
 		.mode		= 0644,
-		.proc_handler	= &proc_dointvec
+		.proc_handler	= &proc_dointvec_minmax,
+		.extra1		= &zero,
 	},
 #else
 	{

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2009-11-30  5:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-30  4:59 [Patch] 'sysctl_max_map_count' should be non-negative Amerigo Wang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox