This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: Potential issue with strstr on x86 with sse4.2 in glibc-2.18
- From: "Carlos O'Donell" <carlos at redhat dot com>
- To: Allan McRae <allan at archlinux dot org>
- Cc: libc-alpha <libc-alpha at sourceware dot org>, Siddhesh Poyarekar <siddhesh at redhat dot com>
- Date: Fri, 16 Aug 2013 11:36:29 -0400
- Subject: Re: Potential issue with strstr on x86 with sse4.2 in glibc-2.18
- References: <520E181D dot 2040308 at archlinux dot org>
On 08/16/2013 08:16 AM, Allan McRae wrote:
> This is more of a heads up as on first glance I suspect this is a gcc
> issue rather than a glibc one.
>
> I have had a number of reports for i686-pc-linux-gnu builds of glibc
> (with gcc 4.8.1 20130725) giving a segfault in __strstr_sse42. Here is
> our bugtracker link: https://bugs.archlinux.org/task/36556 . A bisect
> puts indicates this commit:
>
> http://sourceware.org/git/?p=glibc.git;a=commit;h=f1d70dad
>
> and in particular, reverting this change in
> sysdeps/x86_64/multiarch/strstr.c stops the issue:
>
> -static inline __m128i
> +static __m128i
> __m128i_strloadu (const unsigned char * p, __m128i zero)
>
>
> That's right... adding an inline solves the segfaults, hence why I
> suspect a gcc issue. Also, compiling with -O3 instead of -O2 avoids the
> issue.
>
> Note that this code runs fine on x86_64. We only notice it on our i686
> builds.
Thanks for the heads up.
We also just saw an i686 and gcc 4.8 inlining issue recently where
adding noinline fixed it. It might not be the same issue, but I just
wanted to add our data point. Our example is a little more complicated
though and harder to explain.
Cheers,
Carlos.