Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 9 Oct 2015 20:37:09 +0200
From:      Dimitry Andric <dim@FreeBSD.org>
To:        Craig Rodrigues <rodrigc@FreeBSD.org>
Cc:        freebsd-current <freebsd-current@freebsd.org>, "freebsd-testing@freebsd.org" <freebsd-testing@FreeBSD.org>
Subject:   Re: kyua SIGBUS'ing with clang 3.7.0 (was FreeBSD_HEAD-tests - Build #1540 - Unstable)
Message-ID:  <D7C62C02-FB3B-4A1E-933B-F4E38F6C5B5A@FreeBSD.org>
In-Reply-To: <CAG=rPVe_jYFut%2BP9-qWH9-=xRUk4eJPG=ELqSZFiraziJ3vmZg@mail.gmail.com>
References:  <64208980.212.1444173234007.JavaMail.jenkins@jenkins-9.freebsd.org> <FC8BEE41-D7EB-4648-B5C5-C6249A04815D@gmail.com> <9AA1E7FE-9C61-4730-B597-CD621960B6AB@gmail.com> <16D1DE3E-32FB-4B47-948F-83CF6BCF09C1@FreeBSD.org> <3F707412-A902-4E6F-8662-C49E1A9B8311@gmail.com> <56152FB3.7000205@freebsd.org> <B6E89181-D75E-4200-AB17-4FE5CD0CBAFA@FreeBSD.org> <CAG=rPVe_jYFut%2BP9-qWH9-=xRUk4eJPG=ELqSZFiraziJ3vmZg@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--Apple-Mail=_7EECD821-E132-4FA2-BBBE-71E173466123
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
	charset=us-ascii

On 09 Oct 2015, at 04:29, Craig Rodrigues <rodrigc@FreeBSD.org> wrote:
> 
> On Wed, Oct 7, 2015 at 2:28 PM, Dimitry Andric <dim@freebsd.org> wrote:
>> 
>> Do you still have a copy of the earlier executable?  Can you post it
>> somewhere?
> I was able to reproduce the problem.
...
> #0  0x000000080085dcfd in std::__1::ios_base::Init::Init ()
>   from /usr/lib/libc++.so.1

I have committed a (hopefully temporary) workaround in r289072.  If you
don't want to do a full buildworld, first rebuild clang and install it,
then rebuild libc++ and install it.

After some back-and-forth about the cause, I am now reasonably convinced
that it is due to a bug in clang 3.7.0, as I noted in the commit message:

Some further explanation: libc++'s iostream.cpp contains the definitions
of std::cout, std::cerr and so on.  These global objects are effectively
declared with an alignment of 8 bytes.  When an executable is linked
against libc++.so, it can sometimes get a copy of the global object,
which is then at the same alignment.

However, with clang 3.7.0, the initialization of these global objects
will incorrectly use SSE instructions (e.g. movdqa), whenever the
optimization level is high enough, and SSE is enabled, such as on amd64.
When any of these objects is not aligned to 16 bytes, this will result
in a SIGBUS during iostream initialization.  In contrast, clang 3.6.x
and earlier took the 8 byte alignment into consideration, and avoided
SSE for those particular operations.

After bisecting of upstream changes, I found that the above revision
[llvm r240144] caused the change of this behavior, so I am reverting it
now as a workaround, while a discussion and test case is being prepared
for upstream.

-Dimitry


--Apple-Mail=_7EECD821-E132-4FA2-BBBE-71E173466123
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename=signature.asc
Content-Type: application/pgp-signature;
	name=signature.asc
Content-Description: Message signed with OpenPGP using GPGMail

-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.28

iEYEARECAAYFAlYYCVUACgkQsF6jCi4glqP9HQCeOA4dCJHOAHAA40VB0JKfB95H
lrcAn3nGQuLWbgYUtbuihC8KuA8qM99g
=VjAd
-----END PGP SIGNATURE-----

--Apple-Mail=_7EECD821-E132-4FA2-BBBE-71E173466123--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?D7C62C02-FB3B-4A1E-933B-F4E38F6C5B5A>