From: Hugh Dickins <hughd@google.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Hugh Dickins <hughd@google.com>,
Dave Jones <davej@codemonkey.org.uk>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Oleg Nesterov <oleg@redhat.com>, Michal Hocko <mhocko@suse.com>
Subject: Re: Linux 4.12-rc6
Date: Mon, 19 Jun 2017 21:40:15 -0700 (PDT) [thread overview]
Message-ID: <alpine.LSU.2.11.1706192123460.9853@eggly.anvils> (raw)
In-Reply-To: <alpine.LSU.2.11.1706192006330.6396@eggly.anvils>
On Mon, 19 Jun 2017, Hugh Dickins wrote:
> On Tue, 20 Jun 2017, Linus Torvalds wrote:
> > On Tue, Jun 20, 2017 at 8:26 AM, Dave Jones <davej@codemonkey.org.uk> wrote:
> > > > Hugh Dickins (1):
> > > > mm: larger stack guard gap, between vmas
> > >
> > > This seems to be buggered.
...
> >
> > So maybe that "goto found" condition should have an additional test
> > for "gap_end > gap_start"?
> >
> > Or maybe I'm just hallucinating and missed something. Hugh, Oleg,
> > Michal, can you take another look and double-check this logic?
>
> My first impression is that you've got right to the heart of it,
> before I even started looking. I'll go over that area more carefully
> now, in case there are other such instances, and post a test patch
> for Dave perhaps to try - but probably he's shut down now, so I'll
> then grab a trinity, and see what luck I have with it.
I've added nothing to your understanding: apart from general unease
about whether MAP_FIXED can push us into corners I hadn't expected.
I had originally wanted to add some more checks into DEBUG_VM_RB's
browse_rb(); but realized then that MAP_FIXED is perfectly entitled
to burst through the usual stack gaps I'd wanted to check there.
And I wonder if trinity will discover more issues with those final
adjustments at the end of unmapped_area[_topdowni](). But enough
of deliberation, I'll get my trinity and try out the patch you
suggested below. After a break.
Hugh
---
mm/mmap.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
--- 4.12-rc6/mm/mmap.c 2017-06-19 09:06:10.035407505 -0700
+++ linux/mm/mmap.c 2017-06-19 21:09:28.616707311 -0700
@@ -1817,7 +1817,8 @@ unsigned long unmapped_area(struct vm_un
/* 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 */
@@ -1920,7 +1921,8 @@ unsigned long unmapped_area_topdown(stru
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 */
prev parent reply other threads:[~2017-06-20 4:40 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-19 15:04 Linus Torvalds
2017-06-20 0:26 ` Dave Jones
2017-06-20 2:32 ` Linus Torvalds
2017-06-20 2:52 ` Dave Jones
2017-06-20 3:12 ` Hugh Dickins
2017-06-20 3:42 ` Dave Jones
2017-06-20 9:05 ` Hugh Dickins
2017-06-20 14:44 ` Dave Jones
2017-06-20 9:11 ` Andy Whitcroft
2017-06-20 4:40 ` Hugh Dickins [this message]
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=alpine.LSU.2.11.1706192123460.9853@eggly.anvils \
--to=hughd@google.com \
--cc=davej@codemonkey.org.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=mhocko@suse.com \
--cc=oleg@redhat.com \
--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®