Re: [PATCHv3 33/33] mm, x86: introduce PR_SET_MAX_VADDR and PR_GET_MAX_VADDR
From: Dave Hansen
Date: Fri Feb 17 2017 - 16:09:17 EST
On 02/17/2017 12:02 PM, Linus Torvalds wrote:
> So if you use MAP_FIXED and give an address in the high range, it will
> just always work, and the MM will always consider the task size to be
> the full address space.
> But for the common case where a process does no use MAP_FIXED, the
> kernel will never give a high address by default, and you have to do
> the process control thing to say "I want those high addresses".
Assuming that folks tend to hard-code MAP_FIXED addresses, they'll be
<48 bits and everything will work splendidly. But, if folks do
something like take the CPU-enumerated virtual address size and use that
as a starting point, I can see things breaking.
MPX would definitely break if the hardware saw one of those high
addresses and was not ready for it. It ends up just chopping off the
high bits of the address, so:
index into the same spot in the bounds tables. It does this unless you
put the hardware in the new mode that uses the larger tables, and
consumes more bits of the virtual address.
Is this likely to break anything in practice? Nah. But it would nice
to avoid it.