[all-commits] [llvm/llvm-project] 04e79c: [dfsan] Add a flag to ignore personality routines.

taewookoh via All-commits all-commits at lists.llvm.org
Wed Dec 8 14:48:51 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 04e79cf70b42ad477bb4eaf0483a599797c600f4
      https://github.com/llvm/llvm-project/commit/04e79cf70b42ad477bb4eaf0483a599797c600f4
  Author: Taewook Oh <twoh at fb.com>
  Date:   2021-12-08 (Wed, 08 Dec 2021)

  Changed paths:
    M llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
    A llvm/test/Instrumentation/DataFlowSanitizer/Inputs/personality-routine-abilist.txt
    A llvm/test/Instrumentation/DataFlowSanitizer/ignore_persnality_routine.ll

  Log Message:
  -----------
  [dfsan] Add a flag to ignore personality routines.

This diff adds "dfsan-ignore-personality-routine" flag, which makes
the dfsan pass to not to generate wrappers for the personality functions if the
function is marked uninstrumented.

This flag is to support dfsan with the cases where the exception handling
routines cannot be instrumented (e.g. use the prebuilt version of c++ standard
library). When the personality function cannot be instrumented it is supposed
to be marked "uninstrumented" from the abi list file. While DFSan generates a
wrapper function for uninstrumented functions, it cannot cannot generate a
valid wrapper for vararg functions, and indirect invocation of vararg function
wrapper terminates the execution of dfsan-instrumented programs. This makes
invocation of personality routine to crash the program, because 1) clang adds a
declaration of personality functions as a vararg function with no fixed
argument, and 2) personality routines are always called indirectly.

To address this issue, the flag introduced in this diff makes dfsan to not to
instrument the personality function. This is not the "correct" solution in the
sense that return value label from the personality function will be undefined.
However, in practice, if the exception handling routines are uninstrumented we
wouldn't expect precise label propagation around them, and it would be more
beneficial to make the rest of the program run without termination.

Reviewed By: browneee

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




More information about the All-commits mailing list