Potential issue with strstr on x86 with sse4.2 in glibc-2.18
Carlos O'Donell
carlos@redhat.com
Fri Aug 16 15:36:00 GMT 2013
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.
More information about the Libc-alpha
mailing list