Page MenuHomeFreeBSD

Revert 3c4fd2463bb2 since upstream libcxxrt fixed it in another way
ClosedPublic

Authored by dim on Feb 19 2021, 6:26 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Apr 18, 3:56 AM
Unknown Object (File)
Mar 10 2024, 1:01 PM
Unknown Object (File)
Mar 10 2024, 12:57 PM
Unknown Object (File)
Mar 7 2024, 7:55 PM
Unknown Object (File)
Mar 7 2024, 7:43 PM
Unknown Object (File)
Mar 1 2024, 5:15 AM
Unknown Object (File)
Jan 27 2024, 11:47 PM
Unknown Object (File)
Dec 20 2023, 4:04 AM
Subscribers

Details

Summary

In 0ee0dbfb0d26cf4bc37f24f12e76c7f532b0f368 I imported a more recent
libcxxrt snapshot, which includes an upstream fix for the padding of
struct _Unwind_Exception:

https://github.com/libcxxrt/libcxxrt/commit/e458560b7e22fff59af643dba363544b393bd8db

However, we also had a similar fix in our tree as:
https://cgit.freebsd.org/src/commit/?id=3c4fd2463bb29f65ef1404011fcb31e508cdf2e2

Since having both fixes makes the struct too large again, it leads to
SIGBUSes when throwing exceptions on amd64 (or other LP64 arches). This
is most easily tested by running kyua without any arguments.

It looks like our fix is no longer needed now, so revert it to reduce
diffs against upstream.

Test Plan

Run some exception-throwing C++ programs on amd64 and i386, and check if
they don't SIGBUS.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

dim requested review of this revision.Feb 19 2021, 6:26 PM

This fixes kyua for me, so yes please :)

This revision is now accepted and ready to land.Feb 19 2021, 8:22 PM

The real problem is IMO that there are three subtly incompatible definitions of struct _Unwind_Exception: include/unwind.h, contrib/llvm/libunwind and contrib/libcxxrt. This also caused issues in CheriBSD.

But that's unrelated to this patch which LGTM.

The real problem is IMO that there are three subtly incompatible definitions of struct _Unwind_Exception: include/unwind.h, contrib/llvm/libunwind and contrib/libcxxrt. This also caused issues in CheriBSD.

Yes, reading https://github.com/libcxxrt/libcxxrt/pull/1 you can see that the submitter was attempting to remove the difference with at least llvm's libunwind:

Itanium version is using attribute((aligned)), uintptr_t for private fields, and an added reserved field to be explicit about alignment:
https://github.com/llvm/llvm-project/blob/master/libunwind/include/unwind.h#L123-L143