Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 10 Oct 2015 11:00:21 -0700
From:      Craig Rodrigues <rodrigc@FreeBSD.org>
To:        Dimitry Andric <dim@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:  <CAG=rPVfNyqKx69GE7%2BwoPwELBGBF_0AzN6Qo83UhVwyPhPxZWw@mail.gmail.com>
In-Reply-To: <D7C62C02-FB3B-4A1E-933B-F4E38F6C5B5A@FreeBSD.org>
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> <D7C62C02-FB3B-4A1E-933B-F4E38F6C5B5A@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Oct 9, 2015 at 11:37 AM, Dimitry Andric <dim@freebsd.org> wrote:

>
> 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
>
>

Thank you for analyzing and fixing the problem.  You have excellent
detective
skills and worked hard to fix this!

--
Craig



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAG=rPVfNyqKx69GE7%2BwoPwELBGBF_0AzN6Qo83UhVwyPhPxZWw>