mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-25 20:23:11 +01:00
c5216dadb8
Summary: This protects calls to longjmp from transferring control to arbitrary program points. Instead, longjmp calls are limited to the set of registered setjmp return addresses. This also implements /guard:nolongjmp to allow users to link in object files that call setjmp that weren't compiled with /guard:cf. In this case, the linker will approximate the set of address taken functions, but it will leave longjmp unprotected. I used the following program to test, compiling it with different -guard flags: $ cl -c t.c -guard:cf $ lld-link t.obj -guard:cf #include <setjmp.h> #include <stdio.h> jmp_buf buf; void g() { printf("before longjmp\n"); fflush(stdout); longjmp(buf, 1); } void f() { if (setjmp(buf)) { printf("setjmp returned non-zero\n"); return; } g(); } int main() { f(); printf("hello world\n"); } In particular, the program aborts when the code is compiled *without* -guard:cf and linked with -guard:cf. That indicates that longjmps are protected. Reviewers: ruiu, inglorion, amccarth Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D43217 llvm-svn: 325047 |
||
---|---|---|
.. | ||
ARMEHABIPrinter.h | ||
ARMWinEHPrinter.cpp | ||
ARMWinEHPrinter.h | ||
CMakeLists.txt | ||
COFFDumper.cpp | ||
COFFImportDumper.cpp | ||
ELFDumper.cpp | ||
Error.cpp | ||
Error.h | ||
llvm-readobj.cpp | ||
llvm-readobj.h | ||
LLVMBuild.txt | ||
MachODumper.cpp | ||
ObjDumper.cpp | ||
ObjDumper.h | ||
StackMapPrinter.h | ||
WasmDumper.cpp | ||
Win64EHDumper.cpp | ||
Win64EHDumper.h | ||
WindowsResourceDumper.cpp | ||
WindowsResourceDumper.h |