[all-commits] [llvm/llvm-project] f17680: Revert "[sanitizer] Simplify GetTls with dl_iterat...

Nico Weber via All-commits all-commits at lists.llvm.org
Fri Apr 2 15:19:38 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: f176803ef1f4050a350e01868d64fe09a674d3bf
      https://github.com/llvm/llvm-project/commit/f176803ef1f4050a350e01868d64fe09a674d3bf
  Author: Nico Weber <thakis at chromium.org>
  Date:   2021-04-02 (Fri, 02 Apr 2021)

  Changed paths:
    M compiler-rt/lib/asan/asan_rtl.cpp
    M compiler-rt/lib/asan/asan_thread.cpp
    M compiler-rt/lib/hwasan/hwasan.cpp
    M compiler-rt/lib/lsan/lsan.cpp
    M compiler-rt/lib/memprof/memprof_rtl.cpp
    M compiler-rt/lib/msan/msan.cpp
    M compiler-rt/lib/sanitizer_common/sanitizer_common.h
    M compiler-rt/lib/sanitizer_common/sanitizer_fuchsia.cpp
    M compiler-rt/lib/sanitizer_common/sanitizer_linux.h
    M compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cpp
    M compiler-rt/lib/sanitizer_common/sanitizer_mac.cpp
    M compiler-rt/lib/sanitizer_common/sanitizer_rtems.cpp
    M compiler-rt/lib/sanitizer_common/sanitizer_win.cpp
    M compiler-rt/lib/sanitizer_common/tests/sanitizer_common_test.cpp
    M compiler-rt/lib/sanitizer_common/tests/sanitizer_linux_test.cpp
    M compiler-rt/lib/tsan/rtl/tsan_platform_linux.cpp

  Log Message:
  -----------
  Revert "[sanitizer] Simplify GetTls with dl_iterate_phdr"

This reverts commit 9be8f8b34d9b150cd1811e3556fe9d0cd735ae29.
This breaks tsan on Ubuntu 16.04:

    $ cat tiny_race.c
    #include <pthread.h>
    int Global;
    void *Thread1(void *x) {
      Global = 42;
      return x;
    }
    int main() {
      pthread_t t;
      pthread_create(&t, NULL, Thread1, NULL);
      Global = 43;
      pthread_join(t, NULL);
      return Global;
    }
    $ out/gn/bin/clang -fsanitize=thread -g -O1 tiny_race.c --sysroot ~/src/chrome/src/build/linux/debian_sid_amd64-sysroot/
    $ docker run -v $PWD:/foo ubuntu:xenial /foo/a.out
    FATAL: ThreadSanitizer CHECK failed: ../../compiler-rt/lib/tsan/rtl/tsan_platform_linux.cpp:447 "((thr_beg)) >= ((tls_addr))" (0x7fddd76beb80, 0xfffffffffffff980)
        #0 <null> <null> (a.out+0x4960b6)
        #1 <null> <null> (a.out+0x4b677f)
        #2 <null> <null> (a.out+0x49cf94)
        #3 <null> <null> (a.out+0x499bd2)
        #4 <null> <null> (a.out+0x42aaf1)
        #5 <null> <null> (libpthread.so.0+0x76b9)
        #6 <null> <null> (libc.so.6+0x1074dc)

(Get the sysroot from here: https://commondatastorage.googleapis.com/chrome-linux-sysroot/toolchain/500976182686961e34974ea7bdc0a21fca32be06/debian_sid_amd64_sysroot.tar.xz)

Also reverts follow-on commits:
This reverts commit 58c62fd9768594ec8dd57e8320ba2396bf8b87e5.
This reverts commit 31e541e37587100a5b21378380f54c028fda2d04.




More information about the All-commits mailing list