[Bug 211123] Throw C++ exception from a signal handler.

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Fri Jul 15 21:28:57 UTC 2016


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=211123

Jilles Tjoelker <jilles at FreeBSD.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jilles at FreeBSD.org
           Keywords|patch                       |

--- Comment #1 from Jilles Tjoelker <jilles at FreeBSD.org> ---
This could be because FreeBSD's signal trampoline does not have proper unwind
information since it is not part of a proper ELF object. Debuggers such as gdb
have a special case for this but the unwinder for C++ exceptions does not.

If you really want to do this, a workaround could be a sigjmp_buf in
thread-local storage.

The null pointer dereference does not raise SIGSEGV because clang detects it as
undefined behaviour, replacing it with an ud2 instruction and deleting
everything after it.

Apart from that, throwing exceptions from arbitrary points in the code is
rather unsafe. Per gcc's documentation, even -fnon-call-exceptions will not
handle asynchronous exceptions. Safely interrupting code at any location
requires process isolation or severe restrictions on the code.

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-bugs mailing list