Re: git: b014e0f15bc7 - main - Enable ASLR by default for 64-bit executables

From: Jessica Clarke <jrtc27_at_freebsd.org>
Date: Wed, 24 Nov 2021 16:54:40 UTC
On 24 Nov 2021, at 16:23, John Baldwin <jhb@FreeBSD.org> wrote:
> On 11/24/21 6:41 AM, Slawa Olhovchenkov wrote:
>> On Tue, Nov 16, 2021 at 10:26:42PM +0000, Marcin Wojtas wrote:
>>> 
>>>     Enable ASLR by default for 64-bit executables
>>>     
>> Now any core dumps will be useless?
> 
> I believe core dumps should be fine.  We include the ELF auxv values in core
> dumps as a NT_PROCSTAT_AUXV note that GDB (and I presume LLDB) both look at
> to determine the location of the main executable (AT_BASE).  Once the dynamic
> section of the main executable is found, DT_DEBUG is used to find the linked
> list of shared libraries (including rtld itself) just as with PDEs.

And if it were broken, it would’ve been broken by switching to building
PIEs, not enabling ASLR. PIEs are linked with a base address of 0, so
even if the kernel has a deterministic address at which it maps such
executables (i.e. ASLR were disabled), it still needs to communicate
that to the debugger somehow. Well, unless you hard-code the address for
every architecture in the debugger, which is clearly a bad idea and not
done.

Jess