[all-commits] [llvm/llvm-project] 37445e: [compiler-rt] Allow 3 simultaneous interceptors on...

Marco Elver via All-commits all-commits at lists.llvm.org
Fri Jun 9 02:32:07 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 37445e96d867f4266993085e821fbd4c4d8fa401
      https://github.com/llvm/llvm-project/commit/37445e96d867f4266993085e821fbd4c4d8fa401
  Author: Marco Elver <elver at google.com>
  Date:   2023-06-09 (Fri, 09 Jun 2023)

  Changed paths:
    M compiler-rt/lib/interception/interception.h
    M compiler-rt/lib/interception/tests/CMakeLists.txt
    A compiler-rt/lib/interception/tests/interception_linux_foreign_test.cpp
    M compiler-rt/lib/interception/tests/interception_linux_test.cpp
    M compiler-rt/lib/sanitizer_common/sanitizer_asm.h
    M compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc
    M compiler-rt/lib/sanitizer_common/sanitizer_stacktrace_printer.cpp
    M compiler-rt/lib/sanitizer_common/scripts/gen_dynamic_list.py
    M compiler-rt/test/asan/TestCases/Posix/asan-symbolize-sanity-test.cpp

  Log Message:
  -----------
  [compiler-rt] Allow 3 simultaneous interceptors on Linux

Rework Linux (and *BSD) interceptors to allow for up to 3 (2 for *BSD)
simultaneous interceptors. See code comments for details.

The main motivation is to support new sampling sanitizers (in the spirit
of GWP-ASan), that have to intercept few functions. Unfortunately, the
reality is that there are user interceptors that exist in the wild.

To support foreign user interceptors, foreign dynamic analysis
interceptors, and compiler-rt interceptors all at the same time,
including any combination of them, this change enables up to 3
interceptors on Linux (2 on *BSD).

v2:
* Revert to to the simpler "weak wrapper -(alias)-> __interceptor"
  scheme on architectures that cannot implement a trampoline efficiently
  due to complexities of resolving a preemptible symbol (PowerPC64
  ELFv2 global entry, and i386 PIC).
* Avoid duplicate intercepted functions in gen_dynamic_list.py, due to
  matching __interceptor_X and ___interceptor_X.
* Fix s390 __tls_get_offset.

Reviewed By: dvyukov, MaskRay, vitalybuka

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




More information about the All-commits mailing list