[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.20.1711141307290.2044@nanos>
Date: Tue, 14 Nov 2017 13:11:41 +0100 (CET)
From: Thomas Gleixner <tglx@...utronix.de>
To: "Kirill A. Shutemov" <kirill@...temov.name>
cc: "Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>,
Ingo Molnar <mingo@...hat.com>,
Linus Torvalds <torvalds@...ux-foundation.org>, x86@...nel.org,
"H. Peter Anvin" <hpa@...or.com>,
Andy Lutomirski <luto@...capital.net>,
Cyrill Gorcunov <gorcunov@...nvz.org>,
Nicholas Piggin <npiggin@...il.com>, linux-mm@...ck.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] x86/mm: Do not allow non-MAP_FIXED mapping across
DEFAULT_MAP_WINDOW border
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
Powered by blists - more mailing lists