On Tue, Nov 14, 2017 at 09:54:52PM +0100, Thomas Gleixner wrote: > On Tue, 14 Nov 2017, Kirill A. Shutemov wrote: > > > On Tue, Nov 14, 2017 at 05:01:50PM +0100, Thomas Gleixner wrote: > > > @@ -198,11 +199,14 @@ arch_get_unmapped_area_topdown(struct fi > > > /* requesting a specific address */ > > > if (addr) { > > > addr = PAGE_ALIGN(addr); > > > + if (!mmap_address_hint_valid(addr, len)) > > > + goto get_unmapped_area; > > > + > > > > Here and in hugetlb_get_unmapped_area(), we should align the addr after > > the check, not before. Otherwise the alignment itself can bring us over > > the borderline as we align up. > > Hmm, then I wonder whether the next check against vm_start_gap() which > checks against the aligned address is correct: > > addr = PAGE_ALIGN(addr); > vma = find_vma(mm, addr); > > if (end - len >= addr && > (!vma || addr + len <= vm_start_gap(vma))) > return addr; I think the check is correct. The check is against resulting addresses that end up in vm_start/vm_end. In our case we want to figure out what user asked for. -- Kirill A. Shutemov -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxx. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>