VM_GROWSDOWN
VM_GROWSDOWN
Posted Aug 23, 2010 13:13 UTC (Mon) by foom (subscriber, #14868)In reply to: VM_GROWSDOWN by spender
Parent article: An ancient kernel hole is closed
If the stacksize is limited, mmap starts allocating below the stack rlimit (the stack is at the top of memory) and moves down until it hits the heap at the beginning of the memoryspace. Then it'll start filling in holes in other places (such as between the end of the actual stack and the stack rlimit size).
If stacksize is not limited, mmap starts allocating partway between the heap and stack, and moves up until it hits the stack. And then starts filling in holes (such as below the begin address above the heap).
It seems to me that it'd be fairly sane to in the first case, also disable the VM_GROWSDOWN behavior and just allocate a stack of the RLIMIT size immediately. But that *would* mean that you lose RLIMIT_STACK amount of memory in your VM space which could've otherwise been used for mmap'ing, which might be a problem in some cases.
Posted Aug 23, 2010 17:51 UTC (Mon)
by PaXTeam (guest, #24616)
[Link]
VM_GROWSDOWN