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

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

Dimitry Andric <dim@FreeBSD.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dim@FreeBSD.org

--- Comment #1 from Dimitry Andric <dim@FreeBSD.org> ---
See also bug 253208, and commit
https://cgit.freebsd.org/src/commit/?id=889b56c8cd84c9a9f2d9e3b019c154d6f14d9021
.

The problem appears to be the setrlimit() call in SDCCmain.c:

/*-------------------------------------------------------------*/
/* setStackSize - set the stack size of a running sdcc process */
/*-------------------------------------------------------------*/
static void                                                                    
                                                                               
                                                                    
setStackSize (void)
{
#if defined (HAVE_SETRLIMIT) && defined (RLIMIT_STACK)
  struct rlimit rl = {4 * 1024 * 1024, 4 * 1024 * 1024};
  setrlimit (RLIMIT_STACK, &rl);
#endif
}

It segfaults immediately upon return from the setrlimit() syscall wrapper.

Doing:

elfctl -e +noaslrstkgap ${WRKSRC}/bin/sdcc

makes the problem go away.

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