[all-commits] [llvm/llvm-project] c6e83d: [Sanitizers][CFG][arm64e] Fix test because -fsanit...

thetruestblue via All-commits all-commits at lists.llvm.org
Mon Dec 12 20:33:31 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: c6e83ddb37aff90b3fff2deb8605bc0adc54b393
      https://github.com/llvm/llvm-project/commit/c6e83ddb37aff90b3fff2deb8605bc0adc54b393
  Author: Blue Gaston <bgaston2 at apple.com>
  Date:   2022-12-12 (Mon, 12 Dec 2022)

  Changed paths:
    M compiler-rt/test/sanitizer_common/TestCases/sanitizer_coverage_control_flow.cpp

  Log Message:
  -----------
  [Sanitizers][CFG][arm64e] Fix test because -fsanitize-coverage=control-flow does not sign BB entry

-fsanitize-coverage=control-flow does not sign entries into basic blocks on arm64e. This test compares a local pointer to a function [signed] with the basic block pointer. Because the entry into the
basic block is unsigned the addresses being compared are signed and unsigned, causing the path never to be taken.
This is a "bandaid" to get this test passing. We strip the signed bits from the pointer to the local functions so that the comparisons pass.
Filed radar: rdar://103042879 to note the behavior.

context: https://github.com/llvm/llvm-project/blob/main/llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp#L1068
    // blockaddress can not be used on function's entry block.
    if (&BB == &F.getEntryBlock())
      CFs.push_back((Constant *)IRB.CreatePointerCast(&F, IntptrPtrTy));
    else
      CFs.push_back((Constant *)IRB.CreatePointerCast(BlockAddress::get(&BB),
                                                      IntptrPtrTy));
BlockAddress::get is responsible for signing the pointer.

Because of:
https://reviews.llvm.org/D133157

rdar://103042879

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




More information about the All-commits mailing list