mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2024-12-18 22:15:46 +01:00
Fix handling of uncaught exceptions in a std::terminate() handler on arm.
When raising an exception, the unwinder searches for a catch handler and if none is found it should invoke std::terminate() with the uncaught exception as the "current" exception. Before this change, the terminate handler was invoked with no exception as current (abi::__cxa_current_exception_type() returned NULL), because the return value from the unwinder indicated an internal failure in unwinding. It turns out that was because all errors from get_eit_entry() were translated to _URC_FAILURE. Now the error is returned untranslated, which allows _URC_END_OF_STACK to percolate upwards to throw_exception() in libcxxrt. When it sees that return status it properly calls std::terminate() with the uncaught exception installed as the current exception, allowing custom terminate handlers to work with it.
This commit is contained in:
parent
05572d356b
commit
237d41f89e
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=323997
@ -625,8 +625,8 @@ __gnu_Unwind_RaiseException (_Unwind_Control_Block * ucbp,
|
||||
do
|
||||
{
|
||||
/* Find the entry for this routine. */
|
||||
if (get_eit_entry (ucbp, saved_vrs.core.r[R_PC]) != _URC_OK)
|
||||
return _URC_FAILURE;
|
||||
if ((pr_result = get_eit_entry (ucbp, saved_vrs.core.r[R_PC])) != _URC_OK)
|
||||
return pr_result;
|
||||
|
||||
/* Call the pr to decide what to do. */
|
||||
pr_result = ((personality_routine) UCB_PR_ADDR (ucbp))
|
||||
|
Loading…
Reference in New Issue
Block a user