From: Ben Hutchings <ben@decadent.org.uk>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: akpm@linux-foundation.org, "Michal Hocko" <mhocko@suse.com>,
"Dave Jones" <davej@codemonkey.org.uk>,
"Linus Torvalds" <torvalds@linux-foundation.org>,
"Hugh Dickins" <hughd@google.com>
Subject: [PATCH 3.16 2/7] mm: fix new crash in unmapped_area_topdown()
Date: Tue, 27 Jun 2017 12:10:34 +0100 [thread overview]
Message-ID: <lsq.1498561834.99387999@decadent.org.uk> (raw)
In-Reply-To: <lsq.1498561833.742501160@decadent.org.uk>
3.16.45-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Hugh Dickins <hughd@google.com>
commit f4cb767d76cf7ee72f97dd76f6cfa6c76a5edc89 upstream.
Trinity gets kernel BUG at mm/mmap.c:1963! in about 3 minutes of
mmap testing. That's the VM_BUG_ON(gap_end < gap_start) at the
end of unmapped_area_topdown(). Linus points out how MAP_FIXED
(which does not have to respect our stack guard gap intentions)
could result in gap_end below gap_start there. Fix that, and
the similar case in its alternative, unmapped_area().
Fixes: 1be7107fbe18 ("mm: larger stack guard gap, between vmas")
Reported-by: Dave Jones <davej@codemonkey.org.uk>
Debugged-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Hugh Dickins <hughd@google.com>
Acked-by: Michal Hocko <mhocko@suse.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
mm/mmap.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -1732,7 +1732,8 @@ check_current:
/* Check if current node has a suitable gap */
if (gap_start > high_limit)
return -ENOMEM;
- if (gap_end >= low_limit && gap_end - gap_start >= length)
+ if (gap_end >= low_limit &&
+ gap_end > gap_start && gap_end - gap_start >= length)
goto found;
/* Visit right subtree if it looks promising */
@@ -1835,7 +1836,8 @@ check_current:
gap_end = vm_start_gap(vma);
if (gap_end < low_limit)
return -ENOMEM;
- if (gap_start <= high_limit && gap_end - gap_start >= length)
+ if (gap_start <= high_limit &&
+ gap_end > gap_start && gap_end - gap_start >= length)
goto found;
/* Visit left subtree if it looks promising */
next prev parent reply other threads:[~2017-06-27 11:12 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-27 11:10 [PATCH 3.16 0/7] 3.16.45-rc1 review Ben Hutchings
2017-06-27 11:10 ` [PATCH 3.16 3/7] Allow stack to grow up to address space limit Ben Hutchings
2017-06-27 11:10 ` [PATCH 3.16 6/7] rxrpc: Fix several cases where a padded len isn't checked in ticket decode Ben Hutchings
2017-06-27 11:10 ` [PATCH 3.16 7/7] KVM: x86: fix singlestepping over syscall Ben Hutchings
2017-06-27 11:10 ` Ben Hutchings [this message]
2017-06-27 11:10 ` [PATCH 3.16 1/7] mm: larger stack guard gap, between vmas Ben Hutchings
2017-06-27 11:10 ` [PATCH 3.16 5/7] drm/vmwgfx: limit the number of mip levels in vmw_gb_surface_define_ioctl() Ben Hutchings
2017-06-27 11:10 ` [PATCH 3.16 4/7] regulator: core: Fix regualtor_ena_gpio_free not to access pin after freeing Ben Hutchings
2017-06-27 13:37 ` [PATCH 3.16 0/7] 3.16.45-rc1 review Guenter Roeck
2017-06-27 17:15 ` Ben Hutchings
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=lsq.1498561834.99387999@decadent.org.uk \
--to=ben@decadent.org.uk \
--cc=akpm@linux-foundation.org \
--cc=davej@codemonkey.org.uk \
--cc=hughd@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mhocko@suse.com \
--cc=stable@vger.kernel.org \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®