linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Laurent Dufour <ldufour@linux.vnet.ibm.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>,
	 Dave Hansen <dave.hansen@linux.intel.com>,
	 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 15:34:14 +0200 (CEST)	[thread overview]
Message-ID: <alpine.DEB.2.21.1904231533190.9956@nanos.tec.linutronix.de> (raw)
In-Reply-To: <6718ede2-1fcb-1a8f-a116-250eef6416c7@linux.vnet.ibm.com>

[-- Attachment #1: Type: text/plain, Size: 1358 bytes --]

On Tue, 23 Apr 2019, Laurent Dufour wrote:
> Le 20/04/2019 à 12:31, Michael Ellerman a écrit :
> > Thomas Gleixner <tglx@linutronix.de> writes:
> > > Aside of that the powerpc variant looks suspicious:
> > > 
> > > static inline void arch_unmap(struct mm_struct *mm,
> > >                                unsigned long start, unsigned long end)
> > > {
> > >   	if (start <= mm->context.vdso_base && mm->context.vdso_base < end)
> > >                  mm->context.vdso_base = 0;
> > > }
> > > 
> > > Shouldn't that be:
> > > 
> > >   	if (start >= mm->context.vdso_base && mm->context.vdso_base < end)
> > > 
> > > Hmm?
> > 
> > Yeah looks pretty suspicious. I'll follow-up with Laurent who wrote it.
> > Thanks for spotting it!
> 
> I've to admit that I had to read that code carefully before answering.
> 
> 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).
> 
> The idea is to handle a munmap() call surrounding the VDSO area:
>       | VDSO |
>  ^start         ^end
> 
> This is covered by this test, as the munmap() matching the exact boundaries of
> the VDSO is handled too.
> 
> Am I missing something ?

Well if this is the intention, then you missed to add a comment explaining it :)

Thanks,

	tglx

  reply	other threads:[~2019-04-23 13:34 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 [this message]
2019-04-23 13:36         ` bos Laurent Dufour
2019-04-23 16:04       ` [PATCH] x86/mpx: fix recursive munmap() corruption Dave Hansen
2019-04-23 17:07         ` 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=alpine.DEB.2.21.1904231533190.9956@nanos.tec.linutronix.de \
    --to=tglx@linutronix.de \
    --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=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