uts: map PIE executables lower in the address space

Review Request #315 - Created Jan. 3, 2017 and updated

Information
Rich Lowe
illumos-gate
3e30333...
Reviewers
general
The traditional layout is such that the primary executable object is low
in the address space, shared libraries are high, and the heap is between
them.  (the stack is at either end, depending).

Since PIE executables are shared libraries, we would otherwise map them
high, leaving processes with no, or almost no, heap.

- implement _MAP_STARTLOW, a flag to map_addr_proc indicating that we
  should seek the lowest address for a mapping rather than the highest
- set the base address for mapping in map_addr_proc to the highest of
  the brkbase or the stack on i386 -- the stack is low on i386 and the
  brkbase can't exist when we're mapping the primary object.
- implement MMOBJ_PRIMARY to mmapobj(2) indicating that the file to be
  mapped is the "primary" object of an executable (such that
  interpretters can also ask that the executable be low in memory)

  
Loading...