Re: HEADS-UP: ASLR for 64-bit executables enabled by default on main

From: Mark Johnston <markj_at_freebsd.org>
Date: Fri, 10 Dec 2021 20:48:51 UTC
On Fri, Dec 10, 2021 at 06:35:47PM +0100, Marcin Wojtas wrote:
> Hi Daniel
> 
> 
> pt., 10 gru 2021 o 10:16 Daniel O'Connor <darius@dons.net.au> napisaƂ(a):
> >
> >
> >
> > > On 17 Nov 2021, at 09:00, Marcin Wojtas <mw@semihalf.com> wrote:
> > > As of b014e0f15bc7 the ASLR (Address Space Layout
> > > Randomization) feature becomes enabled for the all 64-bit
> > > binaries by default.
> >
> > Firstly, thank your for your efforts here, it is appreciated :)
> >
> > I am finding that the lang/sdcc port is crashing with a seg fault and the core dump is no help to me at all:
> > [freebsd14 7:06] /usr/ports/lang/sdcc/work/sdcc-4.0.0/device/lib >sudo gdb ../../bin/sdcc sdcc.core
> > GNU gdb (GDB) 11.1 [GDB v11.1 for FreeBSD]
> > <snip>
> > Reading symbols from ../../bin/sdcc...
> > [New LWP 100122]
> > Core was generated by `../../bin/sdcc -I../../device/include -I../../device/include/mcs51 -mds390 --nos'.
> > Program terminated with signal SIGSEGV, Segmentation fault.
> > Invalid permissions for mapped object.
> > #0  0x0000000804e3fbc0 in setrlimit () from /lib/libc.so.7
> > (gdb) info thread
> >   Id   Target Id         Frame
> > * 1    LWP 100122        0x0000000804e3fbc0 in setrlimit () from /lib/libc.so.7
> > (gdb) bt
> > #0  0x0000000804e3fbc0 in setrlimit () from /lib/libc.so.7
> > Backtrace stopped: Cannot access memory at address 0x7fffff87fd08
> >
> > If I disable ASLR (via proccontrol) then it does not crash, but I am not sure how I can debug it further.
> >
> > I've raised a bug https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=260303 if you (or anyone else) has suggestions for what to try.
> >
> 
> Thanks for filing the ticket. Let's continue the conversation there.

I left a comment there.  The gist of it is that there are several
lingering problems with the stack gap implementation, and I think we
should re-disable it on main until there's some consensus on how to
proceed.