lkml.org 
[lkml]   [2017]   [Nov]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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.


\
 
 \ /
  Last update: 2017-11-15 15:18    [W:0.721 / U:0.572 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site