[all-commits] [llvm/llvm-project] 67bcce: [CFI][LowerTypeTests] Fix indirect call with alias...
Igor Kudrin via All-commits
all-commits at lists.llvm.org
Mon Oct 28 13:15:03 PDT 2024
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 67bcce21415c7f687c28eb727c40b27924335f5a
https://github.com/llvm/llvm-project/commit/67bcce21415c7f687c28eb727c40b27924335f5a
Author: Igor Kudrin <ikudrin at accesssoftek.com>
Date: 2024-10-28 (Mon, 28 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 (#106185)
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