[all-commits] [llvm/llvm-project] 9dad34: tsan: strip __libc_start_main frame

Dmitry Vyukov via All-commits all-commits at lists.llvm.org
Wed Jul 28 11:26:55 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 9dad34423b649f8d8ff2f4e6cee0c600f28f2d57
      https://github.com/llvm/llvm-project/commit/9dad34423b649f8d8ff2f4e6cee0c600f28f2d57
  Author: Dmitry Vyukov <dvyukov at google.com>
  Date:   2021-07-28 (Wed, 28 Jul 2021)

  Changed paths:
    M compiler-rt/lib/tsan/rtl/tsan_rtl_report.cpp
    M compiler-rt/test/tsan/java_symbolization.cpp

  Log Message:
  -----------
  tsan: strip __libc_start_main frame

We strip all frames below main but in some cases it may be not enough.
Namely, when main is instrumented but does not call any other instrumented code.
In this case __tsan_func_entry in main obtains PC pointing to __libc_start_main
(as we pass caller PC to __tsan_func_entry), but nothing obtains PC pointing
to main itself (as main does not call any instrumented code).
In such case we will not have main in the stack, and stripping everything
below main won't work.
So strip __libc_start_main explicitly as well.
But keep stripping of main because __libc_start_main is glibc/linux-specific,
so looking for main is more reliable (and usually main is present in stacks).

Depends on D106957.

Reviewed By: vitalybuka

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




More information about the All-commits mailing list