[all-commits] [llvm/llvm-project] 8dfc67: [libc++][hardening] Rework how the assertion handl...
Konstantin Varlamov via All-commits
all-commits at lists.llvm.org
Wed Jan 17 18:56:20 PST 2024
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 8dfc67d6724eb0af5d278f4d1d5511ca9f9e039f
https://github.com/llvm/llvm-project/commit/8dfc67d6724eb0af5d278f4d1d5511ca9f9e039f
Author: Konstantin Varlamov <varconsteq at gmail.com>
Date: 2024-01-17 (Wed, 17 Jan 2024)
Changed paths:
M libcxx/CMakeLists.txt
M libcxx/docs/BuildingLibcxx.rst
M libcxx/docs/ReleaseNotes/18.rst
M libcxx/docs/UsingLibcxx.rst
M libcxx/include/CMakeLists.txt
M libcxx/include/__assert
M libcxx/test/libcxx/assertions/modes/enabling_assertions_enables_extensive_mode.pass.cpp
M libcxx/test/libcxx/assertions/modes/override_with_debug_mode.pass.cpp
M libcxx/test/libcxx/assertions/modes/override_with_extensive_mode.pass.cpp
M libcxx/test/libcxx/assertions/modes/override_with_fast_mode.pass.cpp
M libcxx/test/libcxx/assertions/modes/override_with_unchecked_mode.pass.cpp
M libcxx/test/libcxx/containers/sequences/deque/asan_caterpillar.pass.cpp
M libcxx/test/std/algorithms/alg.modifying.operations/alg.fill/pstl.exception_handling.pass.cpp
M libcxx/test/std/algorithms/alg.modifying.operations/alg.move/pstl.exception_handling.pass.cpp
M libcxx/test/std/algorithms/alg.modifying.operations/alg.replace/pstl.exception_handling.pass.cpp
M libcxx/test/std/algorithms/alg.modifying.operations/alg.rotate/pstl.exception_handling.pass.cpp
M libcxx/test/std/algorithms/alg.modifying.operations/alg.transform/pstl.exception_handling.pass.cpp
M libcxx/test/std/algorithms/alg.nonmodifying/alg.all_of/pstl.exception_handling.pass.cpp
M libcxx/test/std/algorithms/alg.nonmodifying/alg.any_of/pstl.exception_handling.pass.cpp
M libcxx/test/std/algorithms/alg.nonmodifying/alg.equal/pstl.exception_handling.pass.cpp
M libcxx/test/std/algorithms/alg.nonmodifying/alg.find/pstl.exception_handling.pass.cpp
M libcxx/test/std/algorithms/alg.nonmodifying/alg.foreach/pstl.exception_handling.pass.cpp
M libcxx/test/std/algorithms/alg.nonmodifying/alg.none_of/pstl.exception_handling.pass.cpp
M libcxx/test/std/algorithms/alg.sorting/alg.merge/pstl.exception_handling.pass.cpp
M libcxx/test/std/algorithms/alg.sorting/alg.sort/stable.sort/pstl.exception_handling.pass.cpp
M libcxx/test/std/algorithms/numeric.ops/reduce/pstl.exception_handling.pass.cpp
M libcxx/test/std/algorithms/numeric.ops/transform.reduce/pstl.exception_handling.pass.cpp
M libcxx/test/support/check_assertion.h
M libcxx/utils/libcxx/header_information.py
A libcxx/vendor/llvm/default_assertion_handler.in
Log Message:
-----------
[libc++][hardening] Rework how the assertion handler can be overridden. (#77883)
Previously there were two ways to override the verbose abort function
which gets called when a hardening assertion is triggered:
- compile-time: define the `_LIBCPP_VERBOSE_ABORT` macro;
- link-time: provide a definition of `__libcpp_verbose_abort` function.
This patch adds a new configure-time approach: the vendor can provide
a path to a custom header file which will get copied into the build by
CMake and included by the library. The header must provide a definition
of the
`_LIBCPP_ASSERTION_HANDLER` macro which is what will get called should
a hardening assertion fail. As of this patch, overriding
`_LIBCPP_VERBOSE_ABORT` will still work, but the previous mechanisms
will be effectively removed in a follow-up patch, making the
configure-time mechanism the sole way of overriding the default handler.
Note that `_LIBCPP_ASSERTION_HANDLER` only gets invoked when a hardening
assertion fails. It does not affect other cases where
`_LIBCPP_VERBOSE_ABORT` is currently used (e.g. when an exception is
thrown in the `-fno-exceptions` mode).
The library provides a default version of the custom header file that
will get used if it's not overridden by the vendor. That allows us to
always test the override mechanism and reduces the difference in
configuration between the pristine version of the library and
a platform-specific version.
More information about the All-commits
mailing list