Re: Troubles building world on stable/13 [How to set just the compiler to avoid ASLR being enabled for it]

From: Mark Millard <marklmi_at_yahoo.com>
Date: Sat, 05 Feb 2022 01:34:13 UTC
The following shows how to examine and control the compiler's ASLR
status (notation shown presumes first cd'ing to where the c++ file
is):

# elfctl c++
File 'c++' features:
noaslr          'Disable ASLR' is unset.
noprotmax       'Disable implicit PROT_MAX' is unset.
nostackgap      'Disable stack gap' is unset.
wxneeded        'Requires W+X mappings' is unset.
la48            'amd64: Limit user VA to 48bit' is unset.
noaslrstkgap    'Disable ASLR stack gap' is unset.

# elfctl -e +noaslr c++

# elfctl c++
File 'c++' features:
noaslr          'Disable ASLR' is set.
noprotmax       'Disable implicit PROT_MAX' is unset.
nostackgap      'Disable stack gap' is unset.
wxneeded        'Requires W+X mappings' is unset.
la48            'amd64: Limit user VA to 48bit' is unset.
noaslrstkgap    'Disable ASLR stack gap' is unset.

(noaslrstkgap may be fairly specific to the vintage of
main [so: 14] that I'm at and so might not show up.)

Being tied to the file, this survives reboots.

This should avoid needing the system wide disable
that I'd previously listed. In other words: no need
for:

# sysctl kern.elf64.aslr.enable=0

(which would not survive a reboot).

===
Mark Millard
marklmi at yahoo.com