[all-commits] [llvm/llvm-project] 7440e4: [sanitizer] Add re-execution on FreeBSD when ASLR ...

Dimitry Andric via All-commits all-commits at lists.llvm.org
Mon Nov 27 13:43:46 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 7440e4ed85aa992718d4b5ccd1c97724bc3bdd2c
      https://github.com/llvm/llvm-project/commit/7440e4ed85aa992718d4b5ccd1c97724bc3bdd2c
  Author: Dimitry Andric <dimitry at andric.com>
  Date:   2023-11-27 (Mon, 27 Nov 2023)

  Changed paths:
    M compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp
    M compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cpp

  Log Message:
  -----------
  [sanitizer] Add re-execution on FreeBSD when ASLR is detected (#73439)

In the FreeBSD base system, re-executing the main binary when ASLR is
detected was implemented in the following commits:

* freebsd/freebsd-src at 7cafe89f9ce33
* freebsd/freebsd-src at 96fe7c8ab0f65
* freebsd/freebsd-src at 930a7c2ac67e1
* freebsd/freebsd-src at 0a736f0a6aeb0
* freebsd/freebsd-src at 4c9a0adad1826

Squash all these to bring them into upstream compiler-rt.

When ASLR is detected to be enabled, this first force-disables ASLR for
the current process, then calls ReExec(). The ReExec() function gets a
FreeBSD specific implementation for finding the path of the executed
program, via the ELF auxiliary vector. This is done without calling into
the regular elf_aux_info(3) function, as that makes use of several
already-intercepted functions.




More information about the All-commits mailing list