Re: [PATCH] x86/mm: Do not allow non-MAP_FIXED mapping across DEFAULT_MAP_WINDOW border

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

--
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>



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]
  Powered by Linux