From: Dave Hansen <dave.hansen@intel.com>
To: Sasha Levin <sashal@kernel.org>,
tip-bot for Dave Hansen <tipbot@zytor.com>,
linux-tip-commits@vger.kernel.org
Cc: dave.hansen@linux.intel.com, tglx@linutronix.de, mhocko@suse.com,
Vlastimil Babka <vbabka@suse.cz>,
Andy Lutomirski <luto@amacapital.net>,
Andrew Morton <akpm@linux-foundation.org>,
linux-mm@kvack.org, stable@vger.kernel.org
Subject: Re: [tip:x86/urgent] x86/mpx: Fix recursive munmap() corruption
Date: Thu, 18 Apr 2019 12:06:18 -0700 [thread overview]
Message-ID: <09aa9f89-14e1-a188-057b-592e2fc845e6@intel.com> (raw)
In-Reply-To: <20190418182927.A78AB217D7@mail.kernel.org>
On 4/18/19 11:29 AM, Sasha Levin wrote:
> This commit has been processed because it contains a "Fixes:" tag,
> fixing commit: 1de4fa14ee25 x86, mpx: Cleanup unused bound tables.
>
> The bot has tested the following trees: v5.0.8, v4.19.35, v4.14.112, v4.9.169, v4.4.178.
>
> v5.0.8: Build OK!
> v4.19.35: Failed to apply! Possible dependencies:
> dd2283f2605e ("mm: mmap: zap pages with read mmap_sem in munmap")
I probably should have looked more closely at the state of the code
before dd2283f2605e. A more correct Fixes: would probably have referred
to dd2283f2605e. *It* appears to be the root cause rather than the
original MPX code that I called out.
The pre-dd2283f2605e code does this:
> /*
> * Remove the vma's, and unmap the actual pages
> */
> detach_vmas_to_be_unmapped(mm, vma, prev, end);
> unmap_region(mm, vma, prev, start, end);
>
> arch_unmap(mm, vma, start, end);
>
> /* Fix up all other VM information */
> remove_vma_list(mm, vma);
But, this is actually safe. arch_unmap() can't see 'vma' in the rbtree
because it's been detached, so it can't do anything to 'vma' that might
be unsafe for remove_vma_list()'s use of 'vma'.
The bug in dd2283f2605e was moving unmap_region() to the after arch_unmap().
I confirmed this by running the reproducer on v4.19.35. It did not
trigger anything there, even with a bunch of debugging enabled which
detected the issue in 5.0.
next prev parent reply other threads:[~2019-04-18 19:06 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <tip-508b8482ea2227ba8695d1cf8311166a455c2ae0@git.kernel.org>
2019-04-18 18:29 ` Sasha Levin
2019-04-18 19:06 ` Dave Hansen [this message]
2019-04-18 19:19 ` Thomas Gleixner
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=09aa9f89-14e1-a188-057b-592e2fc845e6@intel.com \
--to=dave.hansen@intel.com \
--cc=akpm@linux-foundation.org \
--cc=dave.hansen@linux.intel.com \
--cc=linux-mm@kvack.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=luto@amacapital.net \
--cc=mhocko@suse.com \
--cc=sashal@kernel.org \
--cc=stable@vger.kernel.org \
--cc=tglx@linutronix.de \
--cc=tipbot@zytor.com \
--cc=vbabka@suse.cz \
/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