[all-commits] [llvm/llvm-project] a36801: [asan] Always skip first object from dl_iterate_phdr

Luís Marques via All-commits all-commits at lists.llvm.org
Mon Apr 25 20:55:51 PDT 2022


  Branch: refs/heads/release/14.x
  Home:   https://github.com/llvm/llvm-project
  Commit: a36801750327d05d5f8a19aec33819ae3f8f5e35
      https://github.com/llvm/llvm-project/commit/a36801750327d05d5f8a19aec33819ae3f8f5e35
  Author: Michael Forney <mforney at mforney.org>
  Date:   2022-04-25 (Mon, 25 Apr 2022)

  Changed paths:
    M compiler-rt/lib/asan/asan_linux.cpp

  Log Message:
  -----------
  [asan] Always skip first object from dl_iterate_phdr

All platforms return the main executable as the first dl_phdr_info.
FreeBSD, NetBSD, Solaris, and Linux-musl place the executable name
in the dlpi_name field of this entry. It appears that only Linux-glibc
uses the empty string.

To make this work generically on all platforms, unconditionally
skip the first object (like is currently done for FreeBSD and NetBSD).
This fixes first DSO detection on Linux-musl. It also would likely
fix detection on Solaris/Illumos if it were to gain PIE support
(since dlpi_addr would not be NULL).

Additionally, only skip the Linux VDSO on linux.

Finally, use the empty string as the "seen first dl_phdr_info"
marker rather than (char *)-1. If there was no other object, we
would try to dereference it for a string comparison.

Reviewed By: MaskRay, vitalybuka

Differential Revision: https://reviews.llvm.org/D119515

(cherry picked from commit 795b07f5498c7e5783237418f34d7ea69e801f87)


  Commit: 0e27d08cdeb338766a477fba071b3df7a06ea6e2
      https://github.com/llvm/llvm-project/commit/0e27d08cdeb338766a477fba071b3df7a06ea6e2
  Author: Luís Marques <luismarques at lowrisc.org>
  Date:   2022-04-25 (Mon, 25 Apr 2022)

  Changed paths:
    M llvm/lib/Target/RISCV/MCTargetDesc/RISCVAsmBackend.cpp
    A llvm/test/MC/RISCV/align-option-relax.s
    M llvm/test/MC/RISCV/align.s

  Log Message:
  -----------
  [RISCV] Fix crash for section alignment with .option norvc

The existing code wasn't getting the subtarget info from the fragment,
so the current status of RVC would be ignored. This would cause a crash
for the new test case when the target then reported it couldn't write
the requested number of code alignment bytes.

Differential Revision: https://reviews.llvm.org/D122236

(cherry picked from commit d09d297c5d28bd0af4dd8bf3ca66d8dbbd196d9d)


Compare: https://github.com/llvm/llvm-project/compare/1f4c7b2a9120...0e27d08cdeb3


More information about the All-commits mailing list