[linux] 02/04: mm/mmap.c: expand_downwards: don't require the gap if !vm_prev
debian-kernel at lists.debian.org
debian-kernel at lists.debian.org
Sat Dec 2 15:26:34 UTC 2017
This is an automated email from the git hooks/post-receive script.
benh pushed a commit to branch jessie
in repository linux.
commit ce399c04a032ef3df3cf21b6dbb066a6eeadc7fa
Author: Ben Hutchings <ben at decadent.org.uk>
Date: Thu Nov 30 01:06:17 2017 +0000
mm/mmap.c: expand_downwards: don't require the gap if !vm_prev
---
debian/changelog | 1 +
...xpand_downwards-don-t-require-the-gap-if-.patch | 56 ++++++++++++++++++++++
debian/patches/series | 1 +
3 files changed, 58 insertions(+)
diff --git a/debian/changelog b/debian/changelog
index 16c71d1..3eba2f3 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -438,6 +438,7 @@ linux (3.16.51-1) UNRELEASED; urgency=medium
* mm: Avoid ABI change in 3.16.50
* inet_frag: Limit ABI change in 3.16.51
* [s390*] mm: Avoid ABI change in 3.16.51
+ * mm/mmap.c: expand_downwards: don't require the gap if !vm_prev
-- Salvatore Bonaccorso <carnil at debian.org> Thu, 05 Oct 2017 21:54:27 +0200
diff --git a/debian/patches/bugfix/all/mm-mmap.c-expand_downwards-don-t-require-the-gap-if-.patch b/debian/patches/bugfix/all/mm-mmap.c-expand_downwards-don-t-require-the-gap-if-.patch
new file mode 100644
index 0000000..f4f6590
--- /dev/null
+++ b/debian/patches/bugfix/all/mm-mmap.c-expand_downwards-don-t-require-the-gap-if-.patch
@@ -0,0 +1,56 @@
+From: Oleg Nesterov <oleg at redhat.com>
+Date: Mon, 10 Jul 2017 15:49:54 -0700
+Subject: mm/mmap.c: expand_downwards: don't require the gap if !vm_prev
+Origin: https://git.kernel.org/linus/32e4e6d5cbb0c0e427391635991fe65e17797af8
+
+expand_stack(vma) fails if address < stack_guard_gap even if there is no
+vma->vm_prev. I don't think this makes sense, and we didn't do this
+before the recent commit 1be7107fbe18 ("mm: larger stack guard gap,
+between vmas").
+
+We do not need a gap in this case, any address is fine as long as
+security_mmap_addr() doesn't object.
+
+This also simplifies the code, we know that address >= prev->vm_end and
+thus underflow is not possible.
+
+Link: http://lkml.kernel.org/r/20170628175258.GA24881@redhat.com
+Signed-off-by: Oleg Nesterov <oleg at redhat.com>
+Acked-by: Michal Hocko <mhocko at suse.com>
+Cc: Hugh Dickins <hughd at google.com>
+Cc: Larry Woodman <lwoodman at redhat.com>
+Signed-off-by: Andrew Morton <akpm at linux-foundation.org>
+Signed-off-by: Linus Torvalds <torvalds at linux-foundation.org>
+---
+ mm/mmap.c | 10 +++-------
+ 1 file changed, 3 insertions(+), 7 deletions(-)
+
+--- a/mm/mmap.c
++++ b/mm/mmap.c
+@@ -2221,7 +2221,6 @@ int expand_downwards(struct vm_area_stru
+ unsigned long address)
+ {
+ struct vm_area_struct *prev;
+- unsigned long gap_addr;
+ int error;
+
+ address &= PAGE_MASK;
+@@ -2230,15 +2229,12 @@ int expand_downwards(struct vm_area_stru
+ return error;
+
+ /* Enforce stack_guard_gap */
+- gap_addr = address - stack_guard_gap;
+- if (gap_addr > address)
+- return -ENOMEM;
+ prev = vma->vm_prev;
+- if (prev && prev->vm_end > gap_addr &&
++ /* Check that both stack segments have the same anon_vma? */
++ if (prev && !(prev->vm_flags & VM_GROWSDOWN) &&
+ (prev->vm_flags & (VM_WRITE|VM_READ|VM_EXEC))) {
+- if (!(prev->vm_flags & VM_GROWSDOWN))
++ if (address - prev->vm_end < stack_guard_gap)
+ return -ENOMEM;
+- /* Check that both stack segments have the same anon_vma? */
+ }
+
+ /* We must make sure the anon_vma is allocated. */
diff --git a/debian/patches/series b/debian/patches/series
index 96d412d..59449cf 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -248,6 +248,7 @@ bugfix/all/ixgbe-do-not-call-check_link-for-ethtool-in-ixgbe_ge.patch
bugfix/all/ipv6-fix-a-refcnt-leak-with-peer-addr.patch
bugfix/all/ipv6-use-addrconf_get_prefix_route-to-remove-peer-ad.patch
bugfix/all/vfs-avoid-creation-of-inode-number-0-in-get_next_ino.patch
+bugfix/all/mm-mmap.c-expand_downwards-don-t-require-the-gap-if-.patch
# memfd_create() & kdbus backport
features/all/kdbus/mm-allow-drivers-to-prevent-new-writable-mappings.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