[Bug 260303] lang/sdcc: seg fault during build (ASLR fallout)

From: <bugzilla-noreply_at_freebsd.org>
Date: Fri, 10 Dec 2021 14:45:04 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=260303

Dawid Gorecki <dgr@semihalf.com> changed:

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

--- Comment #2 from Dawid Gorecki <dgr@semihalf.com> ---
Yeah, this problem is caused by stack gap. The program crashes immediately
after calling setrlimit because it limits the stack to a very low value(4M).
The stack gap in FreeBSD is often larger than that, for amd64 it can be by
default as large as 15M. If the stack gap is larger than stack resource limit
then you can see what happens.

The commit Dimitry linked is related to this issue. However, while we take into
account the size of the stack gap when calculating stack limit, we only do so
for rlim_cur, rlim_max acts as a hard limit, which is not adjusted. The only
way to fix this issue currently is by either disabling the stack gap or by
setting rlim_max to a larger value. 20M should be enough. In that situation
rlim_cur would automatically adjust itself to 4M + stack_gap.

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