Date: Fri, 25 Aug 2017 13:56:06 -0700 From: Mark Millard <markmi@dsl-only.net> To: Tijl Coosemans <tijl@FreeBSD.org>, FreeBSD Current <freebsd-current@freebsd.org> Subject: Re: Segfault in _Unwind_* code called from pthread_exit Message-ID: <5E8C029E-F3C2-4442-9334-D9DAE116828B@dsl-only.net>
next in thread | raw e-mail | index | archive | help
Tijl Coosemans tijl at FreeBSD.org wrote on Fri Aug 25 15:40:10 UTC 2017 : > So both GCC and LLVM unwinding look up the return address in the CFI > table and fail when the return address is garbage, but LLVM treats this > as an end-of-stack condition while GCC further tries to see if the > return address points to a signal trampoline by testing the instruction > bytes at that address. On amd64 the garbage address is unreadable so it > segfaults. On i386 it is readable, the test fails and GCC returns > end-of-stack. > > To fix the crash and get predictable behaviour in the other cases I > propose always setting the return address to 0. The attached patch does > this for i386 and amd64. I don't know if other architectures need a > similar patch. If this is fixed it is possibly the fix for bugzilla report: Bug 221423 - gcc std::locale(LocaleName) crashes instead of throwing an exception It may also fix some examples mentioned in comments for: Bug 221288 - lang/gcc5 links against libsupc++ when compiling but the original description did not happen to involve exception handling from what I can see. Instead __dynamic_cast failed. === Mark Millard markmi at dsl-only.net
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5E8C029E-F3C2-4442-9334-D9DAE116828B>