From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4.1) Gecko/20031009
Description of problem:
This version of libGL contains a buggy assembler
routine for _mesa_test_os_sse_exception_support.
The end of the assembler routine looks roughly like
and that "addl $32,%esp" is buggy, since it de-allocates
the stack. As a result, the exception that we are testing
for that "divps" results in will _overwrite_ the stack
location that "ldmxcsr" will restore the XCSR from.
So first you get a (correct) SIGFPE from the divps, and
when that returns you will get a (deadly) SIGSEGV from
ldmxcsr and the program dies.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. Run _just_ the right combination of kernel and stack offsets
(which will depend on a lot of things, but 2.6.0-test8 generally
2. Run any program using libGL (eg "glxinfo")
3. See it segfault
Actual Results: Program dies with SIGSEGV
Expected Results: Program should just run
This is most trivially fixed by just _removing_ that one
"addl $32,%esp" entirely from the _mesa_test_os_exception_support
routine. The "leave" instruction will do the right thing
anyway, and the "addl" instruction is simply buggy and has the
wrong constant in it.
This is also fixed in later versions of DRI CVS (and hopefully
later versions of XFree86 too). Which is where I originally
Ah yes, that makes a lot of sense. I must admit I haven't given the problem
much thought until now, been too busy with other critical stuff for our release,
however it's great to get this nasty one squashed.
I've pulled the fix out of XFree86 CVS head by diffing the 4.3.0 vs. HEAD
versions of that file. The addl is removed now, and should hopefully work.
On a side note, what's odd to me is why ENTER/LEAVE is getting used, as
that is God aweful slow instructions to use in modern code anywhere. I'm
kindof surprised that is there at all. I've filed another bug report to
fix that for the future as well.
Thanks a bunch for pointing this out Linus. I wouldn't have had the time
to allocate to investigate this prior to Fedora Core 1 due to other
priorities, so our users will be very greatful to see this fixed. A lot
less people will get hit while using 2.6.x.
If only there were 36 hours in a day. ;o)
Fix applied to 4.3.0-42 in rawhide as:
As to why the routine uses enter/leave at all: I suspect
the original author really didn't know i386 assembly code,
and had just created a C file that he compiled with some
awful compile optimization options into assembler.
And then he edited the assembler directly. The code is
too ugly for words. But at least it should work now.
*** Bug 105581 has been marked as a duplicate of this bug. ***
An errata has been issued which should help the problem described in this bug report.
This report is therefore being closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files, please follow the link below. You may reopen
this bug report if the solution does not work for you.