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

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


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

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

commit 15aa7d1b7524542806ae6d0994f6f191fcc64626
Author: Salvatore Bonaccorso <carnil at debian.org>
Date:   Thu Jun 15 18:53:31 2017 +0200

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

diff --git a/debian/changelog b/debian/changelog
index 011ee51..04b217d 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,6 +1,7 @@
 linux (4.9.30-2+deb9u1) UNRELEASED; urgency=medium
 
   * mm: enlarge stack guard gap (CVE-2017-1000364)
+  * mm: allow to configure stack gap size
 
  -- Salvatore Bonaccorso <carnil at debian.org>  Tue, 13 Jun 2017 19:05:45 +0200
 
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..f7fdd33
--- /dev/null
+++ b/debian/patches/bugfix/all/mm-allow-to-configure-stack-gap-size.patch
@@ -0,0 +1,68 @@
+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 4.9, adjust location for documentation]
+---
+ 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
+@@ -3932,6 +3932,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
+@@ -805,6 +805,9 @@ static int show_smap(struct seq_file *m,
+ 		   (vma->vm_flags & VM_LOCKED) ?
+ 			(unsigned long)(mss.pss >> (10 + PSS_SHIFT)) : 0);
+ 
++	if (is_stack(m->private, vma))
++		seq_printf(m, "Stack_Gap:      %8lu kB\n", stack_guard_gap >>10);
++
+ 	arch_show_smap(m, vma);
+ 	show_smap_vma_flags(m, vma);
+ 	m_cache_vma(m, vma);
+--- a/mm/mmap.c
++++ b/mm/mmap.c
+@@ -2337,6 +2337,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 2243ae9..7709d24 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -121,6 +121,7 @@ bugfix/all/ipv6-dccp-do-not-inherit-ipv6_mc_list-from-parent.patch
 bugfix/all/crypto-skcipher-Add-missing-api-setkey-checks.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 exported symbol versions
 bugfix/ia64/revert-ia64-move-exports-to-definitions.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