diff options
author | Thurston Dang <thurston@google.com> | 2025-10-16 21:07:52 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-10-16 14:07:52 -0700 |
commit | 7f5ed91684c808444ede24eb01ad9af73b5806e5 (patch) | |
tree | 40a11c31217dc9eb8241e07f1eb66ac1515b642e /clang/lib/CodeGen/CodeGenModule.cpp | |
parent | 67a284a5192bef0f99ee1debecdf72bfbe67a083 (diff) | |
download | llvm-7f5ed91684c808444ede24eb01ad9af73b5806e5.zip llvm-7f5ed91684c808444ede24eb01ad9af73b5806e5.tar.gz llvm-7f5ed91684c808444ede24eb01ad9af73b5806e5.tar.bz2 |
Reapply "[sanitizer] Add cloak_sanitizer_signal_handlers runtime option" (#163308) (#163423)
This reverts commit
https://github.com/llvm/llvm-project/commit/27d8441f8282c740903529d8a6b73401fc6c17fa
i.e., relands 812a225811bd43aff1e5a5cf1117a0531e533504.
This reland uses `raise(SIGSEGV)` instead of trying to segfault via
dereferencing *123. The latter caused buildbot failures for
cloak_{sigaction,signal}.cpp when assertions are enabled, because e.g.,
TSan will assert that 123 is not a valid app memory address, preventing
the segfault from being triggered. While it is conceivable that a
carefully chosen memory address will trigger a segfault, it is cleaner
to directly raise the signal.
Additionally, this reland marks signal_handler_is_from_sanitizer as
`[[maybe_unused]]`.
Original commit message:
If set, signal/sigaction will pretend that the sanitizers did not
preinstall any signal handlers. If a user successfully installs a signal
handler, it will not be cloaked.
The flag is currently off by default, which means this patch should not
affect the behavior of any sanitizers.
This can be useful in an ecosystem where:
1) there exists a library that will install a signal handler iff it does
not detect a preinstalled signal handler (a heuristic to prevent
overriding user-installed exception handlers etc.)
2) the aforementioned library is linked in to some, but not all, apps
3) user-installed signal handlers are intended to have the highest
priority, followed by the library-installed signal handler, and then the
sanitizer's signal handler
The flag is in sanitizer_common, though it is currently only supported
in ASan, LSan, MSan, TSan and UBSan.
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
0 files changed, 0 insertions, 0 deletions