]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
kern_exec: Add kern.stacktop sysctl.
authorDawid Gorecki <dgr@semihalf.com>
Wed, 13 Oct 2021 19:03:37 +0000 (21:03 +0200)
committerMarcin Wojtas <mw@FreeBSD.org>
Fri, 15 Oct 2021 08:21:55 +0000 (10:21 +0200)
commita97d697122da2bfb0baae5f0939d118d119dae33
tree7abb348391cfe24c345e5fc5c5b22dc0f248221e
parent889b56c8cd84c9a9f2d9e3b019c154d6f14d9021
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
sys/kern/kern_exec.c
sys/sys/sysctl.h