linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Safonov <0x7f454c46@gmail.com>
To: Laurent Dufour <ldufour@linux.vnet.ibm.com>,
	Christophe Leroy <christophe.leroy@csgroup.eu>,
	Michael Ellerman <mpe@ellerman.id.au>
Cc: mhocko@suse.com, rguenther@suse.de, linux-mm@kvack.org,
	Dave Hansen <dave.hansen@linux.intel.com>,
	x86@kernel.org, stable@vger.kernel.org,
	LKML <linux-kernel@vger.kernel.org>,
	Dave Hansen <dave.hansen@intel.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	luto@amacapital.net, linuxppc-dev@lists.ozlabs.org,
	Andrew Morton <akpm@linux-foundation.org>,
	vbabka@suse.cz
Subject: Re: [PATCH] x86/mpx: fix recursive munmap() corruption
Date: Tue, 3 Nov 2020 21:08:45 +0000	[thread overview]
Message-ID: <02389b9c-141c-f5b7-756a-516599063766@gmail.com> (raw)
In-Reply-To: <452b347c-0a86-c710-16ba-5a98c12a47e3@linux.vnet.ibm.com>

Hi Laurent, Christophe, Michael, all,

On 11/3/20 5:11 PM, Laurent Dufour wrote:
> Le 23/10/2020 à 14:28, Christophe Leroy a écrit :
[..]
>>>> That seems like it would work for CRIU and make sense in general?
>>>
>>> Sorry for the late answer, yes this would make more sense.
>>>
>>> Here is a patch doing that.
>>>
>>
>> In your patch, the test seems overkill:
>>
>> +    if ((start <= vdso_base && vdso_end <= end) ||  /* 1   */
>> +        (vdso_base <= start && start < vdso_end) || /* 3,4 */
>> +        (vdso_base < end && end <= vdso_end))       /* 2,3 */
>> +        mm->context.vdso_base = mm->context.vdso_end = 0;
>>
>> What about
>>
>>      if (start < vdso_end && vdso_start < end)
>>          mm->context.vdso_base = mm->context.vdso_end = 0;
>>
>> This should cover all cases, or am I missing something ?
>>
>>
>> And do we really need to store vdso_end in the context ?
>> I think it should be possible to re-calculate it: the size of the VDSO
>> should be (&vdso32_end - &vdso32_start) + PAGE_SIZE for 32 bits VDSO,
>> and (&vdso64_end - &vdso64_start) + PAGE_SIZE for the 64 bits VDSO.
> 
> Thanks Christophe for the advise.
> 
> That is covering all the cases, and indeed is similar to the Michael's
> proposal I missed last year.
> 
> I'll send a patch fixing this issue following your proposal.

It's probably not necessary anymore. I've sent patches [1], currently in
akpm, the last one forbids splitting of vm_special_mapping.
So, a user is able munmap() or mremap() vdso as a whole, but not partly.

[1]:
https://lore.kernel.org/linux-mm/20201013013416.390574-1-dima@arista.com/

Thanks,
          Dmitry

  reply	other threads:[~2020-11-03 21:13 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20190401141549.3F4721FE@viggo.jf.intel.com>
     [not found] ` <alpine.DEB.2.21.1904191248090.3174@nanos.tec.linutronix.de>
     [not found]   ` <87d0lht1c0.fsf@concordia.ellerman.id.au>
     [not found]     ` <6718ede2-1fcb-1a8f-a116-250eef6416c7@linux.vnet.ibm.com>
     [not found]       ` <4f43d4d4-832d-37bc-be7f-da0da735bbec@intel.com>
     [not found]         ` <4e1bbb14-e14f-8643-2072-17b4cdef5326@linux.vnet.ibm.com>
2019-05-01 10:32           ` [PATCH] x86/mpx: fix recursive munmap() corruption 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 [this message]
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=02389b9c-141c-f5b7-756a-516599063766@gmail.com \
    --to=0x7f454c46@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=christophe.leroy@csgroup.eu \
    --cc=dave.hansen@intel.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=ldufour@linux.vnet.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linuxppc-dev@lists.ozlabs.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;
as well as URLs for NNTP newsgroup(s).