[Bug 259969] lib.libc.sys.setrlimit_test.setrlimit_stack fails with ASLR on by default

From: <bugzilla-noreply_at_freebsd.org>
Date: Sun, 21 Nov 2021 22:47:05 UTC

Dawid Gorecki <dgr@semihalf.com> changed:

           What    |Removed                     |Added
                 CC|                            |dgr@semihalf.com

--- Comment #2 from Dawid Gorecki <dgr@semihalf.com> ---
This issue is caused by the way setrlimit handles stack gap. Currently
setrlimit does know about stack gap, however only the rlim_cur value is
adjusted taking into consideration the size of the stack gap. rlim_max is a
hard limit, so we don't adjust it.

This test sets stack both rlim_cur and rlim_max to around 4MiB. By default
stack gap that FreeBSD has can be as big as 3% of maximum stack size, so for
amd64 this is around 15M. Because of that, when trying to set stack limit to
4M, in most cases the test will receive SIGSEGV immediately when exiting the
syscall. Adjusting the resource limit from 4M to a value higher than maximum
stack gap size should resolve this problem.

You are receiving this mail because:
You are the assignee for the bug.