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: "Joseph S. Myers" <joseph at codesourcery dot com>
- Cc: Andreas Schwab <schwab at suse dot de>, 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 10:51:59 -0400
- Subject: Re: Potential issue with strstr on x86 with sse4.2 in glibc-2.18
- References: <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> <20130820074329 dot GP20515 at brightrain dot aerifal dot cx> <Pine dot LNX dot 4 dot 64 dot 1308201330120 dot 15834 at digraph dot polyomino dot org dot uk>
On Tue, Aug 20, 2013 at 01:40:56PM +0000, Joseph S. Myers wrote:
> On Tue, 20 Aug 2013, Rich Felker wrote:
>
> > 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?)
>
> As I noted in <http://sourceware.org/ml/libc-alpha/2012-11/msg00147.html>,
> printf should logically be using $(uses-callbacks) but is actually using
> $(exceptions).
>
> I've expanded the corresponding item on the wiki todo list to request
> better consistency checks. But I suspect there will be lots of false
> positives - libc functions can call snprintf internally using only
> standard formats, for example, and it would be undefined behavior if a
> user had overridden those standard formats at that time, so the fact that
> a library function calls snprintf does not mean that function can use
> callbacks even though snprintf can - unless it calls snprintf with a fully
> user-controlled format, in which case of course it does need to allow for
> user callbacks. Likewise, use of qsort with a callback function defined
> within the library is always fine.
I agree that's a non-issue. The real issue is that the current CFLAGS
permit GCC to assume that, on entry to snprintf, the stack is aligned
mod 16. This is actually false when snprintf is called from other
parts of glibc.
Rich