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: Rich Felker <dalias at aerifal dot cx>
- To: Andreas Schwab <schwab at suse dot de>
- Cc: Allan McRae <allan at archlinux dot org>, Alexander Monakov <amonakov at ispras dot ru>, libc-alpha at sourceware dot org
- Date: Tue, 20 Aug 2013 03:43: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> <alpine dot LNX dot 2 dot 00 dot 1308191628370 dot 2626 at monopod dot intra dot ispras dot ru> <20130819144648 dot GF20515 at brightrain dot aerifal dot cx> <alpine dot LNX dot 2 dot 00 dot 1308191924490 dot 2626 at monopod dot intra dot ispras dot ru> <5212A278 dot 3090909 at archlinux dot org> <20130819230644 dot GM20515 at brightrain dot aerifal dot cx> <5212E278 dot 4030703 at archlinux dot org> <20130820033430 dot GN20515 at brightrain dot aerifal dot cx> <20130820043956 dot GO20515 at brightrain dot aerifal dot cx> <mvm1u5oon01 dot fsf at hawking dot suse dot de>
On Tue, Aug 20, 2013 at 09:11:10AM +0200, Andreas Schwab wrote:
> Rich Felker <dalias@aerifal.cx> writes:
>
> > What may be viable is globally using -mpreferred-stack-boundary=2
>
> Please take a look at sysdeps/i386/Makefile.
Hmm, if the list of files which callback to non-libc code is complete,
and by complete I mean not just functions which directly make
callbacks, but also ones which indirectly do so, then I believe this
approach works as long as the compiler does not generate any code
which depends on the stack being aligned. It certainly avoids any
prologue bloat. However, if GCC happens to use SSE in any of the
functions to which -mpreferred-stack-boundary=4 gets applied, and the
application was compiled without 16-byte stack alignment, then crashes
can occur. These could be avoided by adding
-mincoming-stack-boundary=2 to all files, but of course that would
bring in the prologue.
Also, I question whether the set of files that use callbacks is
complete. Due to fopencookie and register_printf_function, all of
stdio could potentially call application code. I suspect there are a
lot more places like this where, due to glibc extensions, functions
which seemingly do not use callbacks actually might... (malloc?)
Rich