HomeFreeBSD

sanitizers: Improve FreeBSD ASLR detection

Description

sanitizers: Improve FreeBSD ASLR detection

The kern.elf64.aslr.pie_enable and kern.elf32.aslr.pie_enable sysctls
control the default setting for PIE binary address randomization, but
it is possible to enable or disable ASLR on a per-process basis. Use
procctl(2) to query whether ASLR is enabled.

(Note that with ASLR enabled but sysctl kern.elf64.aslr.pie_enable=0
a PIE binary will in effect have randomization disabled, and be
functional with msan. This is not intended as as a user-facing control
though. The user can use proccontrol(1) to disable aslr for the
process.)

Approved by: dim
Obtained from: LLVM 64de0064f315f57044294879d9ff4eacb454d45b
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D33933

(cherry picked from commit 7cafe89f9ce33effe6e471b185339d413da1ca46)

Details

Provenance
emasteAuthored on Jan 18 2022, 12:00 AM
Differential Revision
D33933: sanitizers: Improve FreeBSD ASLR detection
Parents
rGc27237d62f05: Reduce bufdaemon/bufspacedaemon shutdown time.
Branches
Unknown
Tags
Unknown