From: John Hubbard <jhubbard@nvidia.com>
To: Michal Hocko <mhocko@kernel.org>, Jann Horn <jannh@google.com>
Cc: Linux-MM <linux-mm@kvack.org>,
Andrew Morton <akpm@linux-foundation.org>,
Khalid Aziz <khalid.aziz@oracle.com>,
Michael Ellerman <mpe@ellerman.id.au>,
Russell King - ARM Linux <linux@armlinux.org.uk>,
Andrea Arcangeli <aarcange@redhat.com>,
Florian Weimer <fweimer@redhat.com>,
Matthew Wilcox <willy@infradead.org>,
<abdhalee@linux.vnet.ibm.com>, <joel@jms.id.au>,
Kees Cook <keescook@chromium.org>, <jasone@google.com>,
<davidtgoldblatt@gmail.com>, <trasz@freebsd.org>,
Anshuman Khandual <khandual@linux.vnet.ibm.com>,
Daniel Micay <danielmicay@gmail.com>,
kernel list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] mm: don't clobber partially overlapping VMA with MAP_FIXED_NOREPLACE
Date: Wed, 10 Oct 2018 11:03:49 -0700 [thread overview]
Message-ID: <93ee9489-d4cc-70e2-40fa-c78cf17add9a@nvidia.com> (raw)
In-Reply-To: <20181010173857.GM5873@dhcp22.suse.cz>
On 10/10/18 10:38 AM, Michal Hocko wrote:
> On Wed 10-10-18 19:26:50, Jann Horn wrote:
> [...]
>> As you can see, the first page of the mapping at 0x10001000 was clobbered.
>>
>>>> diff --git a/mm/mmap.c b/mm/mmap.c
>>>> index 5f2b2b184c60..f7cd9cb966c0 100644
>>>> --- a/mm/mmap.c
>>>> +++ b/mm/mmap.c
>>>> @@ -1410,7 +1410,7 @@ unsigned long do_mmap(struct file *file, unsigned long addr,
>>>> if (flags & MAP_FIXED_NOREPLACE) {
>>>> struct vm_area_struct *vma = find_vma(mm, addr);
>>>>
>>>> - if (vma && vma->vm_start <= addr)
>>>> + if (vma && vma->vm_start < addr + len)
>>>
>>> find_vma is documented to - Look up the first VMA which satisfies addr <
>>> vm_end, NULL if none.
>>> This means that the above check guanratees that
>>> vm_start <= addr < vm_end
>>> so an overlap is guanrateed. Why should we care how much we overlap?
>>
>> "an overlap is guaranteed"? I have no idea what you're trying to say.
>
> I have misread your changelog and the patch. Sorry about that. I thought
> you meant a false possitive but you in fact meant false negative. Now it
> makes complete sense.
>
> Acked-by: Michal Hocko <mhocko@suse.com>
>
> And thanks a lot for catching that!
>
This also looks good to me.
thanks,
--
John Hubbard
NVIDIA
WARNING: multiple messages have this Message-ID (diff)
From: John Hubbard <jhubbard@nvidia.com>
To: Michal Hocko <mhocko@kernel.org>, Jann Horn <jannh@google.com>
Cc: Linux-MM <linux-mm@kvack.org>,
Andrew Morton <akpm@linux-foundation.org>,
Khalid Aziz <khalid.aziz@oracle.com>,
Michael Ellerman <mpe@ellerman.id.au>,
Russell King - ARM Linux <linux@armlinux.org.uk>,
Andrea Arcangeli <aarcange@redhat.com>,
Florian Weimer <fweimer@redhat.com>,
Matthew Wilcox <willy@infradead.org>,
abdhalee@linux.vnet.ibm.com, joel@jms.id.au,
Kees Cook <keescook@chromium.org>,
jasone@google.com, davidtgoldblatt@gmail.com, trasz@freebsd.org,
Anshuman Khandual <khandual@linux.vnet.ibm.com>,
Daniel Micay <danielmicay@gmail.com>,
kernel list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] mm: don't clobber partially overlapping VMA with MAP_FIXED_NOREPLACE
Date: Wed, 10 Oct 2018 11:03:49 -0700 [thread overview]
Message-ID: <93ee9489-d4cc-70e2-40fa-c78cf17add9a@nvidia.com> (raw)
In-Reply-To: <20181010173857.GM5873@dhcp22.suse.cz>
On 10/10/18 10:38 AM, Michal Hocko wrote:
> On Wed 10-10-18 19:26:50, Jann Horn wrote:
> [...]
>> As you can see, the first page of the mapping at 0x10001000 was clobbered.
>>
>>>> diff --git a/mm/mmap.c b/mm/mmap.c
>>>> index 5f2b2b184c60..f7cd9cb966c0 100644
>>>> --- a/mm/mmap.c
>>>> +++ b/mm/mmap.c
>>>> @@ -1410,7 +1410,7 @@ unsigned long do_mmap(struct file *file, unsigned long addr,
>>>> if (flags & MAP_FIXED_NOREPLACE) {
>>>> struct vm_area_struct *vma = find_vma(mm, addr);
>>>>
>>>> - if (vma && vma->vm_start <= addr)
>>>> + if (vma && vma->vm_start < addr + len)
>>>
>>> find_vma is documented to - Look up the first VMA which satisfies addr <
>>> vm_end, NULL if none.
>>> This means that the above check guanratees that
>>> vm_start <= addr < vm_end
>>> so an overlap is guanrateed. Why should we care how much we overlap?
>>
>> "an overlap is guaranteed"? I have no idea what you're trying to say.
>
> I have misread your changelog and the patch. Sorry about that. I thought
> you meant a false possitive but you in fact meant false negative. Now it
> makes complete sense.
>
> Acked-by: Michal Hocko <mhocko@suse.com>
>
> And thanks a lot for catching that!
>
This also looks good to me.
thanks,
--
John Hubbard
NVIDIA
next prev parent reply other threads:[~2018-10-10 18:03 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-10 15:27 [PATCH] mm: don't clobber partially overlapping VMA with MAP_FIXED_NOREPLACE Jann Horn
2018-10-10 17:19 ` Michal Hocko
2018-10-10 17:26 ` Jann Horn
2018-10-10 17:38 ` Michal Hocko
2018-10-10 18:03 ` John Hubbard [this message]
2018-10-10 18:03 ` John Hubbard
2018-10-10 18:17 ` John Hubbard
2018-10-10 18:17 ` John Hubbard
2018-10-12 10:23 ` Michael Ellerman
2018-10-12 12:09 ` Jann Horn
2018-10-10 18:36 ` Kees Cook
2018-10-12 12:03 ` Vlastimil Babka
2018-10-15 7:47 ` Khalid Aziz
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=93ee9489-d4cc-70e2-40fa-c78cf17add9a@nvidia.com \
--to=jhubbard@nvidia.com \
--cc=aarcange@redhat.com \
--cc=abdhalee@linux.vnet.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=danielmicay@gmail.com \
--cc=davidtgoldblatt@gmail.com \
--cc=fweimer@redhat.com \
--cc=jannh@google.com \
--cc=jasone@google.com \
--cc=joel@jms.id.au \
--cc=keescook@chromium.org \
--cc=khalid.aziz@oracle.com \
--cc=khandual@linux.vnet.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux@armlinux.org.uk \
--cc=mhocko@kernel.org \
--cc=mpe@ellerman.id.au \
--cc=trasz@freebsd.org \
--cc=willy@infradead.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.