From owner-dev-commits-src-branches@freebsd.org Sat Feb 20 20:03:53 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 343C9552AAF; Sat, 20 Feb 2021 20:03:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DjfXT13Vyz4dSD; Sat, 20 Feb 2021 20:03:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1739E2542D; Sat, 20 Feb 2021 20:03:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 11KK3qHI005945; Sat, 20 Feb 2021 20:03:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11KK3q3m005944; Sat, 20 Feb 2021 20:03:52 GMT (envelope-from git) Date: Sat, 20 Feb 2021 20:03:52 GMT Message-Id: <202102202003.11KK3q3m005944@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dimitry Andric Subject: git: 49e7d3fee6ac - stable/11 - Revert 3c4fd2463bb2 since upstream libcxxrt fixed it in another way MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dim X-Git-Repository: src X-Git-Refname: refs/heads/stable/11 X-Git-Reftype: branch X-Git-Commit: 49e7d3fee6ac52d1c65160a71b1f2be70e43c5e1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Feb 2021 20:03:53 -0000 The branch stable/11 has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=49e7d3fee6ac52d1c65160a71b1f2be70e43c5e1 commit 49e7d3fee6ac52d1c65160a71b1f2be70e43c5e1 Author: Dimitry Andric AuthorDate: 2021-02-19 18:18:22 +0000 Commit: Dimitry Andric CommitDate: 2021-02-20 20:01:49 +0000 Revert 3c4fd2463bb2 since upstream libcxxrt fixed it in another way 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. PR: 253226 Reviewed by: arichardson, kp Differential Revision: https://reviews.freebsd.org/D28799 (cherry picked from commit d2b3fadf2db56131376a71b0597876b591a6aee4) --- contrib/libcxxrt/exception.cc | 30 ++++++------------------------ 1 file changed, 6 insertions(+), 24 deletions(-) diff --git a/contrib/libcxxrt/exception.cc b/contrib/libcxxrt/exception.cc index 0de878e9e6db..0fb26ddb4ed2 100644 --- a/contrib/libcxxrt/exception.cc +++ b/contrib/libcxxrt/exception.cc @@ -572,19 +572,6 @@ static void free_exception(char *e) } } -#ifdef __LP64__ -/** - * There's an ABI bug in __cxa_exception: unwindHeader requires 16-byte - * alignment but it was broken by the addition of the referenceCount. - * The unwindHeader is at offset 0x58 in __cxa_exception. In order to keep - * compatibility with consumers of the broken __cxa_exception, explicitly add - * padding on allocation (and account for it on free). - */ -static const int exception_alignment_padding = 8; -#else -static const int exception_alignment_padding = 0; -#endif - /** * Allocates an exception structure. Returns a pointer to the space that can * be used to store an object of thrown_size bytes. This function will use an @@ -593,19 +580,16 @@ static const int exception_alignment_padding = 0; */ extern "C" void *__cxa_allocate_exception(size_t thrown_size) { - size_t size = exception_alignment_padding + sizeof(__cxa_exception) + - thrown_size; + size_t size = thrown_size + sizeof(__cxa_exception); char *buffer = alloc_or_die(size); - return buffer + exception_alignment_padding + sizeof(__cxa_exception); + return buffer+sizeof(__cxa_exception); } extern "C" void *__cxa_allocate_dependent_exception(void) { - size_t size = exception_alignment_padding + - sizeof(__cxa_dependent_exception); + size_t size = sizeof(__cxa_dependent_exception); char *buffer = alloc_or_die(size); - return buffer + exception_alignment_padding + - sizeof(__cxa_dependent_exception); + return buffer+sizeof(__cxa_dependent_exception); } /** @@ -633,8 +617,7 @@ extern "C" void __cxa_free_exception(void *thrown_exception) } } - free_exception(reinterpret_cast(ex) - - exception_alignment_padding); + free_exception(reinterpret_cast(ex)); } static void releaseException(__cxa_exception *exception) @@ -661,8 +644,7 @@ void __cxa_free_dependent_exception(void *thrown_exception) { releaseException(realExceptionFromException(reinterpret_cast<__cxa_exception*>(ex))); } - free_exception(reinterpret_cast(ex) - - exception_alignment_padding); + free_exception(reinterpret_cast(ex)); } /**