[linux] 05/06: fold me "mm: allow to configure stack gap size"
debian-kernel at lists.debian.org
debian-kernel at lists.debian.org
Mon Jun 19 15:38:08 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 12c973540618e5985eeddb392aa5908d630a3d84
Author: Salvatore Bonaccorso <carnil at debian.org>
Date: Fri Jun 16 13:15:55 2017 +0200
fold me "mm: allow to configure stack gap size"
---
debian/changelog | 1 +
...d-me-mm-allow-to-configure-stack-gap-size.patch | 79 ++++++++++++++++++++++
debian/patches/series | 1 +
3 files changed, 81 insertions(+)
diff --git a/debian/changelog b/debian/changelog
index 9c8c51e..f719c2f 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -26,6 +26,7 @@ linux (3.16.43-2+deb8u1) UNRELEASED; urgency=medium
* mm: allow to configure stack gap size
* mm, proc: cap the stack gap for unpopulated growing vmas
* mm: do not collapse stack gap into THP
+ * fold me "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/fold-me-mm-allow-to-configure-stack-gap-size.patch b/debian/patches/bugfix/all/fold-me-mm-allow-to-configure-stack-gap-size.patch
new file mode 100644
index 0000000..6447d59
--- /dev/null
+++ b/debian/patches/bugfix/all/fold-me-mm-allow-to-configure-stack-gap-size.patch
@@ -0,0 +1,79 @@
+From: Michal Hocko <mhocko at suse.com>
+Date: Fri, 16 Jun 2017 00:06:28 +0200
+Subject: fold me "mm: allow to configure stack gap size"
+Bug-Debian-Security: https://security-tracker.debian.org/tracker/CVE-2017-1000364
+
+- do not rely on is_stack when reporting the gap. show_map_vma has
+ all the information we need
+[carnil: backport for 3.16, adjust context, use of vm_is_stack in 3.16 rather
+is_stack]
+---
+ fs/proc/task_mmu.c | 19 +++++++++++++------
+ 1 file changed, 13 insertions(+), 6 deletions(-)
+
+--- a/fs/proc/task_mmu.c
++++ b/fs/proc/task_mmu.c
+@@ -251,7 +251,7 @@ static int do_maps_open(struct inode *in
+ }
+
+ static void
+-show_map_vma(struct seq_file *m, struct vm_area_struct *vma, int is_pid)
++show_map_vma(struct seq_file *m, struct vm_area_struct *vma, int is_pid, bool *has_gap)
+ {
+ struct mm_struct *mm = vma->vm_mm;
+ struct file *file = vma->vm_file;
+@@ -278,11 +278,17 @@ show_map_vma(struct seq_file *m, struct
+ start = vma->vm_start;
+ end = vma->vm_end;
+ if (vma->vm_flags & VM_GROWSDOWN) {
+- if (stack_guard_area(vma, start))
++ if (stack_guard_area(vma, start)) {
+ start = min(end, start + stack_guard_gap);
++ if (has_gap)
++ *has_gap = true;
++ }
+ } else if (vma->vm_flags & VM_GROWSUP) {
+- if (stack_guard_area(vma, end))
++ if (stack_guard_area(vma, end)) {
+ end = max(start, end - stack_guard_gap);
++ if (has_gap)
++ *has_gap = true;
++ }
+ }
+
+ seq_setwidth(m, 25 + sizeof(void *) * 6 - 1);
+@@ -359,7 +365,7 @@ static int show_map(struct seq_file *m,
+ struct proc_maps_private *priv = m->private;
+ struct task_struct *task = priv->task;
+
+- show_map_vma(m, vma, is_pid);
++ show_map_vma(m, vma, is_pid, NULL);
+
+ if (m->count < m->size) /* vma is copied successfully */
+ m->version = (vma != get_gate_vma(task->mm))
+@@ -598,6 +604,7 @@ static int show_smap(struct seq_file *m,
+ .mm = vma->vm_mm,
+ .private = &mss,
+ };
++ bool has_gap = false;
+
+ memset(&mss, 0, sizeof mss);
+ mss.vma = vma;
+@@ -605,7 +612,7 @@ static int show_smap(struct seq_file *m,
+ if (vma->vm_mm && !is_vm_hugetlb_page(vma))
+ walk_page_range(vma->vm_start, vma->vm_end, &smaps_walk);
+
+- show_map_vma(m, vma, is_pid);
++ show_map_vma(m, vma, is_pid, &has_gap);
+
+ seq_printf(m,
+ "Size: %8lu kB\n"
+@@ -642,7 +649,7 @@ 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))
++ if (has_gap)
+ seq_printf(m, "Stack_Gap: %8lu kB\n", stack_guard_gap >>10);
+
+ show_smap_vma_flags(m, vma);
diff --git a/debian/patches/series b/debian/patches/series
index 74d634b..7733634 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -714,6 +714,7 @@ bugfix/all/mm-enlarge-stack-guard-gap.patch
bugfix/all/mm-allow-to-configure-stack-gap-size.patch
bugfix/all/mm-proc-cap-the-stack-gap-for-unpopulated-growing-vm.patch
bugfix/all/mm-do-not-collapse-stack-gap-into-THP.patch
+bugfix/all/fold-me-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