From: Dave Hansen <dave.hansen@intel.com>
To: Laurent Dufour <ldufour@linux.vnet.ibm.com>,
Michael Ellerman <mpe@ellerman.id.au>,
Thomas Gleixner <tglx@linutronix.de>,
Dave Hansen <dave.hansen@linux.intel.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
rguenther@suse.de, mhocko@suse.com, vbabka@suse.cz,
luto@amacapital.net, x86@kernel.org,
Andrew Morton <akpm@linux-foundation.org>,
linux-mm@kvack.org, stable@vger.kernel.org
Subject: Re: [PATCH] x86/mpx: fix recursive munmap() corruption
Date: Tue, 23 Apr 2019 09:04:45 -0700 [thread overview]
Message-ID: <4f43d4d4-832d-37bc-be7f-da0da735bbec@intel.com> (raw)
In-Reply-To: <6718ede2-1fcb-1a8f-a116-250eef6416c7@linux.vnet.ibm.com>
On 4/23/19 4:16 AM, Laurent Dufour wrote:
> My only concern is the error path.
> Calling arch_unmap() before handling any error case means that it will
> have to be undo and there is no way to do so.
Is there a practical scenario where munmap() of the VDSO can split a
VMA? If the VDSO is guaranteed to be a single page, it would have to be
a scenario where munmap() was called on a range that included the VDSO
*and* other VMA that we failed to split.
But, the scenario would have to be that someone tried to munmap() the
VDSO and something adjacent, the munmap() failed, and they kept on using
the VDSO and expected the special signal and perf behavior to be maintained.
BTW, what keeps the VDSO from merging with an adjacent VMA? Is it just
the vm_ops->close that comes from special_mapping_vmops?
> I don't know what is the rational to move arch_unmap() to the beginning
> of __do_munmap() but the error paths must be managed.
It's in the changelog:
https://patchwork.kernel.org/patch/10909727/
But, the tl;dr version is: x86 is recursively calling __do_unmap() (via
arch_unmap()) in a spot where the internal rbtree data is inconsistent,
which causes all kinds of fun. If we move arch_unmap() to before
__do_munmap() does any data structure manipulation, the recursive call
doesn't get confused any more.
> There are 2 assumptions here:
> 1. 'start' and 'end' are page aligned (this is guaranteed by __do_munmap().
> 2. the VDSO is 1 page (this is guaranteed by the union vdso_data_store on powerpc)
Are you sure about #2? The 'vdso64_pages' variable seems rather
unnecessary if the VDSO is only 1 page. ;)
next prev parent reply other threads:[~2019-04-23 16:04 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-01 14:15 Dave Hansen
2019-04-19 10:55 ` Thomas Gleixner
2019-04-20 10:31 ` Michael Ellerman
2019-04-23 11:16 ` Laurent Dufour
2019-04-23 13:34 ` Thomas Gleixner
2019-04-23 13:36 ` bos Laurent Dufour
2019-04-23 16:04 ` Dave Hansen [this message]
2019-04-23 17:07 ` [PATCH] x86/mpx: fix recursive munmap() corruption Laurent Dufour
2019-05-01 10:32 ` Michael Ellerman
2019-05-07 16:35 ` Laurent Dufour
2020-10-23 12:28 ` Christophe Leroy
2020-11-03 17:11 ` Laurent Dufour
2020-11-03 21:08 ` Dmitry Safonov
2020-11-04 9:41 ` Laurent Dufour
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=4f43d4d4-832d-37bc-be7f-da0da735bbec@intel.com \
--to=dave.hansen@intel.com \
--cc=akpm@linux-foundation.org \
--cc=dave.hansen@linux.intel.com \
--cc=ldufour@linux.vnet.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=luto@amacapital.net \
--cc=mhocko@suse.com \
--cc=mpe@ellerman.id.au \
--cc=rguenther@suse.de \
--cc=stable@vger.kernel.org \
--cc=tglx@linutronix.de \
--cc=vbabka@suse.cz \
--cc=x86@kernel.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