linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: "Kirill A. Shutemov" <kirill@shutemov.name>
Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
	Ingo Molnar <mingo@redhat.com>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
	Andy Lutomirski <luto@amacapital.net>,
	Cyrill Gorcunov <gorcunov@openvz.org>,
	Nicholas Piggin <npiggin@gmail.com>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] x86/mm: Do not allow non-MAP_FIXED mapping across DEFAULT_MAP_WINDOW border
Date: Tue, 14 Nov 2017 13:11:41 +0100 (CET)	[thread overview]
Message-ID: <alpine.DEB.2.20.1711141307290.2044@nanos> (raw)
In-Reply-To: <20171114120520.u3cyxw42wqvvnnf6@node.shutemov.name>

On Tue, 14 Nov 2017, Kirill A. Shutemov wrote:
> On Mon, Nov 13, 2017 at 10:14:36PM +0100, Thomas Gleixner wrote:
> > I can see where you are heading to. Now the case I was looking at is:
> > 
> > arch_get_unmapped_area_topdown()
> > 
> > 	addr0 = addr;
> > 	
> > 	....
> > 	if (addr) {
> > 		if (cross_border(addr, len))
> > 			goto get_unmapped_area;
> > 		...
> > 	}
> > get_unmapped_area:
> > 	...
> > 	if (addr > DEFAULT_MAP_WINDOW && !in_compat_syscall())
> > 
> > 	   ^^^ evaluates to false because addr < DEFAULT_MAP_WINDOW
> > 
> > 	addr - vm_unmapped_area(&info);
> > 
> > 	   ^^^ fails for whatever reason.
> > 
> > bottomup:
> > 	return arch_get_unmapped_area(.., addr0, len, ....);
> > 
> > 
> > AFAICT arch_get_unmapped_area() can allocate a mapping which crosses the
> > border, i.e. a mapping which you want to prevent for the !MAP_FIXED case.
> 
> No, it can't as long as addr0 is below DEFAULT_MAP_WINDOW:
> 
> arch_get_unmapped_area()
> {
> 	...
> 	find_start_end(addr, flags, &begin, &end);
> 	// end is DEFAULT_MAP_WINDOW here, since addr is below the border

Sigh, I missed that task_size_64bit() magic in find_start_end().

This is really convoluted and non intuitive. I'm so not looking forward to
debug any failure in that context.

Thanks,

	tglx

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2017-11-14 12:12 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-07 13:05 Kirill A. Shutemov
2017-11-13 15:43 ` Thomas Gleixner
2017-11-13 16:41   ` Kirill A. Shutemov
2017-11-13 16:57     ` Thomas Gleixner
2017-11-13 19:14       ` Thomas Gleixner
2017-11-13 20:06         ` Kirill A. Shutemov
2017-11-13 21:14           ` Thomas Gleixner
2017-11-14 12:05             ` Kirill A. Shutemov
2017-11-14 12:11               ` Thomas Gleixner [this message]
2017-11-13 20:00       ` Kirill A. Shutemov
2017-11-13 21:17         ` Thomas Gleixner
2017-11-14 12:06           ` Kirill A. Shutemov

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.20.1711141307290.2044@nanos \
    --to=tglx@linutronix.de \
    --cc=gorcunov@openvz.org \
    --cc=hpa@zytor.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=kirill@shutemov.name \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=luto@amacapital.net \
    --cc=mingo@redhat.com \
    --cc=npiggin@gmail.com \
    --cc=torvalds@linux-foundation.org \
    --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