On 28 April 2016 at 14:24, Peter Maydell peter.maydell@linaro.org wrote:
On 28 April 2016 at 14:17, Arnd Bergmann arnd@arndb.de wrote:
One simple (from the kernel's perspective, not from the JIT) approach might be to always use MAP_FIXED whenever an allocation is made for memory that needs these special pointers, and then manage the available address space explicitly. Would that work, or do you require everything including the binary itself to be below the address?
The trouble IME with this idea is that in practice you're linking with glibc, which means glibc is managing (and using) the address space, not the JIT. So MAP_FIXED is pretty awkward to use.
thanks -- PMM
Hi,
One can find holes in the VA space by examining /proc/self/maps, thus selection of pointers for MAP_FIXED can be deduced.
The other problem is, as Arnd alluded to, if a JIT'ed object needs to then refer to something allocated outside of the JIT. This could be remedied by another level of indirection/trampoline.
Taking two steps back though, I would view VA space squeezing as a stop-gap before removing tags from the upper bits of a pointer altogether (tagging the bottom bits, by controlling alignment is perfectly safe). The larger the VA space, the more scope mechanisms such as Address Space Layout Randomisation have to improve security.
Cheers, -- Steve