[all-commits] [llvm/llvm-project] 454aba: [CFI][LowerTypeTests] Fix indirect call with alias...

Igor Kudrin via All-commits all-commits at lists.llvm.org
Thu Oct 31 13:29:29 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 454abad7b0b995927f314842349a4db321e3b6b9
      https://github.com/llvm/llvm-project/commit/454abad7b0b995927f314842349a4db321e3b6b9
  Author: Igor Kudrin <ikudrin at accesssoftek.com>
  Date:   2024-10-31 (Thu, 31 Oct 2024)

  Changed paths:
    M llvm/include/llvm/IR/ModuleSummaryIndexYAML.h
    M llvm/lib/Transforms/IPO/LowerTypeTests.cpp
    A llvm/test/Transforms/LowerTypeTests/cfi-icall-alias.ll

  Log Message:
  -----------
  [CFI][LowerTypeTests] Fix indirect call with alias (#113987)

This is a fixed version of #106185, which was reverted in #113978 due to
a buildbot failure.

Motivation example:
```
> cat test.cpp
extern "C" [[gnu::weak]] void f() {}
void alias() __attribute__((alias("f")));
int main() { auto p = alias; p(); }
> clang test.cpp -fsanitize=cfi-icall -flto=thin -fuse-ld=lld
> ./a.out
[1]    1868 illegal hardware instruction  ./a.out
```

If the address of a function was only taken through its alias, the
function was not considered exported and therefore was not included in
the CFI jumptable. This resulted in `@llvm.type.test()` being lowered to
`false`, and consequently the indirect call to the function was
eventually optimized to `ubsantrap()`.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list