HomeFreeBSD

kern_exec: Add kern.stacktop sysctl.

Description

kern_exec: Add kern.stacktop sysctl.

With stack gap enabled top of the stack is moved down by a random
amount of bytes. Because of that some multithreaded applications
which use kern.usrstack sysctl to calculate address of stacks for
their threads can fail. Add kern.stacktop sysctl, which can be used
to retrieve address of the stack after stack gap is applied to it.
Returns value identical to kern.usrstack for processes which have
no stack gap.

Reviewed by: kib
Obtained from: Semihalf
Sponsored by: Stormshield
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D31897

Details

Provenance
dgr_semihalf.comAuthored on Oct 13 2021, 7:03 PM
mwCommitted on Oct 15 2021, 8:21 AM
Reviewer
kib
Differential Revision
D31897: kern_exec: Add kern.stacktop sysctl.
Parents
rG889b56c8cd84: setrlimit: Take stack gap into account.
Branches
Unknown
Tags
Unknown
Reverted By
rGc595625abe8e: Revert "kern_exec: Add kern.stacktop sysctl."
rG1544f5add8c7: Revert "kern_exec: Add kern.stacktop sysctl."