[all-commits] [llvm/llvm-project] fad47d: [compiler-rt] Fall back to internal_uname() when c...

Ilya Leoshkevich via All-commits all-commits at lists.llvm.org
Fri Mar 27 19:15:02 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: fad47d222561f0672223b0b3304ff1c739cb3288
      https://github.com/llvm/llvm-project/commit/fad47d222561f0672223b0b3304ff1c739cb3288
  Author: Ilya Leoshkevich <iii at linux.ibm.com>
  Date:   2020-03-28 (Sat, 28 Mar 2020)

  Changed paths:
    M compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc

  Log Message:
  -----------
  [compiler-rt] Fall back to internal_uname() when called early

Summary:
Commit 5f5fb56c68e4 ("[compiler-rt] Intercept the uname() function")
broke sanitizer-x86_64-linux and clang-cmake-thumbv7-full-sh (again)
builds:

http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux/builds/26313
http://lab.llvm.org:8011/builders/clang-cmake-thumbv7-full-sh/builds/4324

The reason is that uname() can be called as early as
__pthread_initialize_minimal_internal(). When intercepted, this
triggers ASan initialization, which eventually calls dlerror(), which
in turn uses pthreads, causing all sorts of issues.

Fix by falling back to internal_uname() when interceptor runs before
ASan is initialized. This is only for Linux at the moment.

Reviewers: eugenis, vitalybuka

Reviewed By: eugenis

Subscribers: dberris, #sanitizers, pcc

Tags: #sanitizers

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




More information about the All-commits mailing list