[all-commits] [llvm/llvm-project] 0f3fd3: [dfsan] Add thread registration

Z via All-commits all-commits at lists.llvm.org
Fri Feb 5 09:39:57 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 0f3fd3b2810d7549d5cf7356b269701d5c5032fa
      https://github.com/llvm/llvm-project/commit/0f3fd3b2810d7549d5cf7356b269701d5c5032fa
  Author: Jianzhou Zhao <jianzhouzh at google.com>
  Date:   2021-02-05 (Fri, 05 Feb 2021)

  Changed paths:
    M compiler-rt/lib/dfsan/CMakeLists.txt
    M compiler-rt/lib/dfsan/dfsan.cpp
    M compiler-rt/lib/dfsan/dfsan_custom.cpp
    A compiler-rt/lib/dfsan/dfsan_thread.cpp
    A compiler-rt/lib/dfsan/dfsan_thread.h
    A compiler-rt/test/dfsan/pthread.c

  Log Message:
  -----------
  [dfsan] Add thread registration

This is a part of https://reviews.llvm.org/D95835.

This change is to address two problems
1) When recording stacks in origin tracking, libunwind is not async signal safe. Inside signal callbacks, we need
to use fast unwind. Fast unwind needs threads
2) StackDepot used by origin tracking is not async signal safe, we set a flag per thread inside
a signal callback to prevent from using it.

The thread registration is similar to ASan and MSan.

Related MSan changes are
* https://github.com/llvm/llvm-project/commit/98f5ea0dbae664a2e5f9381a64f2913fe1add208
* https://github.com/llvm/llvm-project/commit/f653cda2695ac7390fe5663f2c0895213938334d
* https://github.com/llvm/llvm-project/commit/5a7c3643437c262137bd3dac7f6a0f5b9e8501be

Some changes in the diff are used in the next diffs
1) The test case pthread.c is not very interesting for now. It will be
  extended to test origin tracking later.
2) DFsanThread::InSignalHandler will be used by origin tracking later.

Reviewed-by: morehouse

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




More information about the All-commits mailing list