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: libc-alpha at sourceware dot org
- Date: Mon, 19 Aug 2013 10:46:48 -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>
On Mon, Aug 19, 2013 at 04:35:35PM +0400, Alexander Monakov wrote:
> I've had a look and it appears that __strstr_sse42 is entered from fglrx's
> libGL.so.1 with misaligned stack (not divisible by 16), so spilling an SSE
> register to stack fails. Shouldn't glibc realign stack for SSE-accelerated
> functions on x86?
In theory, from a standpoint of supporting old code, yes.
However, gcc is free to use sse in any function it wants, and adding
the gcc option to make the callee realign the stack in all functions
would probably be prohibitively expensive.
I think the gcc folks' changing of the psABI to require 16-byte
alignment was a mistake, and it should have been left alone, and
callees using sse should have been required to do their own
realignment. However this is deep in the past now, and we're stuck
with the bad decision that makes it impossible to support legacy
binaries without a global performance hit.
Really this doesn't even look like a case of a legacy binary, but
rather fglrx's libGL.so.1 simply containing incorrect asm (or just
CFLAGS?) that doesn't match the modern psABI calling convention. It
would probably be best to pressure its maintainers to fix this bug on
their side...
Rich