[linux] 02/06: mm: allow to configure stack gap size

debian-kernel at lists.debian.org debian-kernel at lists.debian.org
Mon Jun 19 15:38:07 UTC 2017


This is an automated email from the git hooks/post-receive script.

carnil pushed a commit to branch jessie-security
in repository linux.

commit 76d0367ab38f1b3c3844560420cc1f1adb5a41dd
Author: Salvatore Bonaccorso <carnil at debian.org>
Date:   Fri Jun 16 10:57:00 2017 +0200

    mm: allow to configure stack gap size
---
 debian/changelog                                   |  1 +
 .../all/mm-allow-to-configure-stack-gap-size.patch | 71 ++++++++++++++++++++++
 debian/patches/series                              |  1 +
 3 files changed, 73 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index 2f77d08..c26a946 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -23,6 +23,7 @@ linux (3.16.43-2+deb8u1) UNRELEASED; urgency=medium
 
   [ Salvatore Bonaccorso ]
   * mm: enlarge stack guard gap (CVE-2017-1000364)
+  * mm: allow to configure stack gap size
 
  -- Ben Hutchings <ben at decadent.org.uk>  Wed, 31 May 2017 11:52:42 +0100
 
diff --git a/debian/patches/bugfix/all/mm-allow-to-configure-stack-gap-size.patch b/debian/patches/bugfix/all/mm-allow-to-configure-stack-gap-size.patch
new file mode 100644
index 0000000..c516800
--- /dev/null
+++ b/debian/patches/bugfix/all/mm-allow-to-configure-stack-gap-size.patch
@@ -0,0 +1,71 @@
+From: Michal Hocko <mhocko at suse.com>
+Date: Wed, 14 Jun 2017 08:17:02 +0200
+Subject: mm: allow to configure stack gap size
+Bug-Debian-Security: https://security-tracker.debian.org/tracker/CVE-2017-1000364
+
+Add a kernel command line option (stack_guard_gap) to specify the stack
+gap size (in page unites) and export the value in /proc/<pid>/smaps for
+stack vmas. This might be used for special applications like CRIU/RR.
+
+Suggested-by: Linus Torvalds <torvalds at linux-foundation.org>
+Signed-off-by: Michal Hocko <mhocko at suse.com>
+[carnil: backport to 3.16
+ - context adjustment
+ - adjust location for documentation
+ - is_stack -> vm_is_stack]
+---
+ Documentation/kernel-parameters.txt |  7 +++++++
+ fs/proc/task_mmu.c                  |  3 +++
+ mm/mmap.c                           | 13 +++++++++++++
+ 3 files changed, 23 insertions(+)
+
+--- a/Documentation/kernel-parameters.txt
++++ b/Documentation/kernel-parameters.txt
+@@ -3150,6 +3150,13 @@ bytes respectively. Such letter suffixes
+ 	spia_pedr=
+ 	spia_peddr=
+ 
++	stack_guard_gap=	[MM]
++			override the default stack gap protection. The value
++			is in page units and it defines how many pages prior
++			to (for stacks growing down) resp. after (for stacks
++			growing up) the main stack are reserved for no other
++			mapping. Default value is 256 pages.
++
+ 	stacktrace	[FTRACE]
+ 			Enabled the stack tracer on boot up.
+ 
+--- a/fs/proc/task_mmu.c
++++ b/fs/proc/task_mmu.c
+@@ -642,6 +642,9 @@ static int show_smap(struct seq_file *m,
+ 		seq_printf(m, "Nonlinear:      %8lu kB\n",
+ 				mss.nonlinear >> 10);
+ 
++	if (vm_is_stack(m->private, vma, is_pid))
++		seq_printf(m, "Stack_Gap:      %8lu kB\n", stack_guard_gap >>10);
++
+ 	show_smap_vma_flags(m, vma);
+ 
+ 	if (m->count < m->size)  /* vma is copied successfully */
+--- a/mm/mmap.c
++++ b/mm/mmap.c
+@@ -2261,6 +2261,19 @@ int expand_downwards(struct vm_area_stru
+ /* enforced gap between the expanding stack and other mappings. */
+ unsigned long stack_guard_gap = 256UL<<PAGE_SHIFT;
+ 
++static int __init cmdline_parse_stack_guard_gap(char *p)
++{
++	unsigned long val;
++	char *endptr;
++
++	val = simple_strtoul(p, &endptr, 10);
++	if (!*endptr)
++		stack_guard_gap = val << PAGE_SHIFT;
++
++	return 0;
++}
++__setup("stack_guard_gap=", cmdline_parse_stack_guard_gap);
++
+ /*
+  * Note how expand_stack() refuses to expand the stack all the way to
+  * abut the next virtual mapping, *unless* that mapping itself is also
diff --git a/debian/patches/series b/debian/patches/series
index 2082352..172a92f 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -711,6 +711,7 @@ bugfix/all/sctp-do-not-inherit-ipv6_-mc-ac-fl-_list-from-parent.patch
 bugfix/all/ipv6-dccp-do-not-inherit-ipv6_mc_list-from-parent.patch
 bugfix/all/ipv6-fix-out-of-bound-writes-in-__ip6_append_data.patch
 bugfix/all/mm-enlarge-stack-guard-gap.patch
+bugfix/all/mm-allow-to-configure-stack-gap-size.patch
 
 # Fix ABI changes
 debian/of-fix-abi-changes.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/kernel/linux.git



More information about the Kernel-svn-changes mailing list