[PATCH] D46326: ThinLTO+CFI: short-circuit direct calls to jump table entries
Peter Collingbourne via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon May 21 21:12:48 PDT 2018
pcc added a comment.
You don't need cross-DSO CFI to reproduce this, the issue has to do with regular ELF interposition.
Here is a standalone reproducer:
$ cat main.c
void baz();
void foo() {
puts("main");
}
int main() {
direct();
indirect();
}
$ cat dso.c
void foo() {
puts("dso");
}
typedef void (*fp)();
fp bar() { return foo; }
void indirect() {
bar()();
}
void direct() {
foo();
}
$ ~/src2/llvm-project4/ra/bin/clang -fsanitize=cfi-icall -shared -o dso.so dso.c -flto -fPIC
$ ~/src2/llvm-project4/ra/bin/clang -fsanitize=cfi-icall -o main main.c -flto dso.so
$ LD_LIBRARY_PATH=. ./main
dso
main
If I rebuild dso.so without cfi-icall I see the correct result:
$ ~/src2/llvm-project4/ra/bin/clang -shared -o dso.so dso.c -flto -fPIC
$ LD_LIBRARY_PATH=. ./main
main
main
Repository:
rL LLVM
https://reviews.llvm.org/D46326
More information about the llvm-commits
mailing list