[PATCH 6/6] nptl: Account for the stack guard gap on pthread_getattr_np (BZ 34637)
Yury Khrustalev
yury.khrustalev@arm.com
Wed Sep 16 14:40:53 GMT 2026
On Tue, Sep 15, 2026 at 03:34:50PM -0300, Adhemerval Zanella wrote:
> The kernel does not grow the stack into the stack_guard_gap (256 pages
> by default, set by the boot parameter of the same name) above the
> mapping below it, so clamping the initial thread stack size to the end
> of that mapping overestimates the usable size by up to the gap.
>
> Change the main stack calculation to take in consideration the guard
> gap. Assume the default value, smaller configured gap only makes the
> computed size conservative. Larger values still might make
> pthread_getattr_np over-report (although it no worse than current
> values).
>
> Checked on x86_64-linux-gnu.
This patch causes regression on i686 and arm-unknown-linux-gnueabihf:
FAIL: nptl/tst-pthread-getattr-guard-gap
error: tst-pthread-getattr-guard-gap.c:90: not true: lo2 <= (uintptr_t) stackaddr && (uintptr_t) stackaddr <= lo
error: tst-pthread-getattr-guard-gap.c:91: not true: (uintptr_t) stackaddr > planted + pagesz
error: 2 test failures
original exit status 1
More information about the Libc-alpha
mailing list