[all-commits] [llvm/llvm-project] 7f5ed9: Reapply "[sanitizer] Add cloak_sanitizer_signal_ha...
Thurston Dang via All-commits
all-commits at lists.llvm.org
Thu Oct 16 14:08:14 PDT 2025
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 7f5ed91684c808444ede24eb01ad9af73b5806e5
https://github.com/llvm/llvm-project/commit/7f5ed91684c808444ede24eb01ad9af73b5806e5
Author: Thurston Dang <thurston at google.com>
Date: 2025-10-16 (Thu, 16 Oct 2025)
Changed paths:
M compiler-rt/lib/sanitizer_common/sanitizer_common.h
M compiler-rt/lib/sanitizer_common/sanitizer_flags.inc
M compiler-rt/lib/sanitizer_common/sanitizer_posix_libcdep.cpp
M compiler-rt/lib/sanitizer_common/sanitizer_signal_interceptors.inc
M compiler-rt/test/sanitizer_common/TestCases/Linux/allow_user_segv.cpp
A compiler-rt/test/sanitizer_common/TestCases/Linux/cloak_sigaction.cpp
A compiler-rt/test/sanitizer_common/TestCases/Linux/cloak_signal.cpp
Log Message:
-----------
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.
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