kernel - Fix serious bug in MAP_STACK, deprecate auto-grow semantics
authorMatthew Dillon <dillon@apollo.backplane.com>
Fri, 3 May 2019 06:03:32 +0000 (23:03 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Fri, 3 May 2019 06:16:24 +0000 (23:16 -0700)
commitd6924570fb487b28d73396f15725fb0b111082dc
tree13687f761d9d657eecf46763f935d4fe53ab6b47
parent4837705ef8eed5e115acd4998b8f162b32e6a6f9
kernel - Fix serious bug in MAP_STACK, deprecate auto-grow semantics

* When MAP_STACK is used without MAP_TRYFIXED, the address the kernel
  determines for the stack was *NOT* being returned to userland.  Instead,
  userland always got only the hint address.

* This fixes ruby MAP_STACK use cases and possibly more.

* Deprecate MAP_STACK auto-grow semantics.  All user mmap() calls with
  MAP_STACK are now converted to normal MAP_ANON mmaps.  The kernel will
  continue to create an auto-grow stack segment for the primary user stack
  in exec(), allowing older pthread libraries to continue working, but this
  feature is deprecated and will be removed in a future release.
sys/kern/kern_exec.c
sys/vm/vm_map.c
sys/vm/vm_map.h
sys/vm/vm_mmap.c