HomeFreeBSD

linprocfs: Skip printing of the guard page in the /proc/self/maps

Description

linprocfs: Skip printing of the guard page in the /proc/self/maps

To calculate the base (lowest addressable) address of the stack of the
initial thread glibc parses /proc/self/maps.
In fact, the base address is calculated as 'to' value of stack entry of the
/proc/self/maps - stack size limit (if the stack grows down).
The base address should fit in between preceding entry and stack entry of
the /proc/self/maps.
In FreeBSD, since 19bd0d9 (Implement address space guards), we actually
have two mappings for the stack region. The first one is the no-access
mapping for the region the stack can grow into (guard page), and the
second - initial stack region with size sgrowsiz.
The first mapping confuses Glibc, in the end which is improperly
calculate stack size and the base address.

PR: 253337
Reviewed by: kib
Differential revision: https://reviews.freebsd.org/D35537
MFC after: 2 week

(cherry picked from commit ef1976ccf5420d0912afcb49733c7a88643069da)

Details

Provenance
dchaginAuthored on Jun 22 2022, 11:49 AM
Reviewer
kib
Differential Revision
D35537: Skip printing of the guard page in the /proc/self/maps
Parents
rG5bdeed846dc0: kdump: Decode Linux *at() syscalls
Branches
Unknown
Tags
Unknown