kyua SIGBUS'ing with clang 3.7.0 (was FreeBSD_HEAD-tests - Build #1540 - Unstable)

Dimitry Andric dim at FreeBSD.org
Fri Oct 9 18:37:14 UTC 2015


On 09 Oct 2015, at 04:29, Craig Rodrigues <rodrigc at FreeBSD.org> wrote:
> 
> On Wed, Oct 7, 2015 at 2:28 PM, Dimitry Andric <dim at 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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 194 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.freebsd.org/pipermail/freebsd-testing/attachments/20151009/4147cb1f/attachment.bin>


More information about the freebsd-testing mailing list