[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.20.1711151509060.1805@nanos>
Date: Wed, 15 Nov 2017 15:18:02 +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>, x86@...nel.org,
"H. Peter Anvin" <hpa@...or.com>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Andy Lutomirski <luto@...capital.net>,
Nicholas Piggin <npiggin@...il.com>, linux-mm@...ck.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCHv2 1/2] x86/mm: Do not allow non-MAP_FIXED mapping across
DEFAULT_MAP_WINDOW border
On Wed, 15 Nov 2017, Kirill A. Shutemov wrote:
> On Wed, Nov 15, 2017 at 12:39:40PM +0100, Thomas Gleixner wrote:
> > > I *think* we should be fine with checking unaligned 'addr'.
> >
> > I think we should keep it consistent for the normal and the huge case and
> > just check aligned and be done with it.
>
> Aligned 'addr'? Or 'len'? Both?
>
> We would have problem with checking aligned addr. I steped it in hugetlb
> case:
>
> - User asks for mmap((1UL << 47) - PAGE_SIZE, 2 << 20, MAP_HUGETLB);
>
> - On 4-level paging machine this gives us invalid hint address as
> 'TASK_SIZE - len' is more than 'addr'. Goto get_unmapped_area.
>
> - On 5-level paging machine hint address gets rounded up to next 2MB
> boundary that is exactly 1UL << 47 and we happily allocate from full
> address space which may lead to trouble.
Ah, right because that ALIGN is using huge_page_size(h) and not PAGE_SIZE.
Powered by blists - more mailing lists