Messages in this thread | | | Date | Wed, 15 Nov 2017 15:18:02 +0100 (CET) | From | Thomas Gleixner <> | 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.
| |