[PATCH] D66377: hwasan: Untag unwound stack frames by wrapping personality functions.
Peter Collingbourne via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 16 18:19:34 PDT 2019
pcc created this revision.
pcc added reviewers: eugenis, hctim.
Herald added subscribers: Sanitizers, hiraditya, mgorny, srhines.
Herald added projects: Sanitizers, LLVM.
One problem with untagging memory in landing pads is that it only works
correctly if the function that catches the exception is instrumented.
If the function is uninstrumented, we have no opportunity to untag the
memory.
To address this, replace landing pad instrumentation with personality function
wrapping. Each function with an instrumented stack has its personality function
replaced with a wrapper provided by the runtime. Functions that did not have
a personality function to begin with also get wrappers if they may be unwound
past. As the unwinder calls personality functions during stack unwinding,
the original personality function is called and the function's stack frame is
untagged by the wrapper if the personality function instructs the unwinder
to keep unwinding. If unwinding stops at a landing pad, the function is
still responsible for untagging its stack frame if it resumes unwinding.
The old landing pad mechanism is preserved for compatibility with old runtimes.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D66377
Files:
compiler-rt/lib/hwasan/CMakeLists.txt
compiler-rt/lib/hwasan/hwasan_exceptions.cpp
compiler-rt/test/hwasan/TestCases/try-catch.cpp
compiler-rt/test/hwasan/lit.cfg.py
llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
llvm/test/Instrumentation/HWAddressSanitizer/landingpad.ll
llvm/test/Instrumentation/HWAddressSanitizer/personality.ll
llvm/utils/gn/secondary/compiler-rt/lib/hwasan/BUILD.gn
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D66377.215729.patch
Type: text/x-patch
Size: 17955 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190817/bb8ec3a9/attachment.bin>
More information about the llvm-commits
mailing list