[all-commits] [llvm/llvm-project] a9c515: [libFuzzer] Fix CFI Directives for fuchsia

Marco Vanotti via All-commits all-commits at lists.llvm.org
Wed Jul 28 17:59:27 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: a9c515983dc26992ce67668ad64f066353853ed1
      https://github.com/llvm/llvm-project/commit/a9c515983dc26992ce67668ad64f066353853ed1
  Author: Marco Vanotti <mvanotti at google.com>
  Date:   2021-07-28 (Wed, 28 Jul 2021)

  Changed paths:
    M compiler-rt/lib/fuzzer/FuzzerUtilFuchsia.cpp

  Log Message:
  -----------
  [libFuzzer] Fix CFI Directives for fuchsia

This commit fixes the CFI directives in the crash trampoline so
libunwind can get a backtrace during a crash.

In order to get a backtrace from a libfuzzer crash in fuchsia, we
resume execution in the crashed thread, forcing it to call the
StaticCrashHandler. We do this by setting a "crash trampoline" that has
all the necessary cfi directives for an unwinder to get full backtrace
for that thread.

Due to a bug in libunwind, it was not possible to restore the RSP
pointer, as it was always set to the call frame address (CFA). The
previous version worked around this issue by setting the CFA to the
value of the stack pointer at the point of the crash.

The bug in libunwind is now fixed[0], so I am correcting the CFI
annotations so that the CFA correctly points to the beginning of the
trampoline's call frame.

[0]: https://reviews.llvm.org/D106626

Reviewed By: mcgrathr

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




More information about the All-commits mailing list