HomeFreeBSD

mmap(MAP_STACK): on stack grow, use original protection

Description

mmap(MAP_STACK): on stack grow, use original protection

If mprotect(2) changed protection in the bottom of the currently grown
stack region, currently the changed protection would be used for the
stack grow on next fault. This is arguably unexpected.

Store the original protection for the entry at mmap(2) time in the
offset member of the gap vm_map_entry, and use it for protection of the
grown stack region.

PR: 272585
Reported by: John F. Carr <jfc@mit.edu>
Reviewed by: alc, markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D41089

Details

Provenance
kibAuthored on Jul 19 2023, 11:05 AM
Reviewer
alc
Differential Revision
D41089: mmap(MAP_STACK): on stack grow, use original protection
Parents
rGa52f23f4c49e: iflib: Unlock ctx lock around call to ether_ifattach()
Branches
Unknown
Tags
Unknown