[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#333766: libc6: SIGBUS in libm on hppa breaks qt-x11-free



On Fri, Oct 14, 2005 at 06:17:46AM +0200, Aurelien Jarno wrote:
> I have attached a patch that changes the alignment of the f_env type. I 
> have tested it separately from the glibc, it works.

Yes, your patch looks right.

Please also add the following comment in front of the fenv_t declaration.
It will help explain what's going on:

/* While fr0-fr3 appear as 64-bit registers, they aren't 64-bit quantities.
 * They are really one 32-bit status register and seven 32-bit exception
 * registers. We just sodomize the fpu 64-bit store semantics for efficiency.
 *
 * 8 byte alignment is "only" needed for performance.
 * Normally the kernel will squawk about (but handle) unaligned accesses.
 *
 * fr4 is the first usable FP register.
 */

The above is a summary of an IRC conversation with the hppa glibc
guru (Carlos O'donell), Kyle Mcmartin, and myself.

> However, I would prefer that some people have a look to the
> asm code of the glibc to see what can be done.

Sorry - I've no clue where the offending asm lives.
The asm ( 4 fstd ops) posted by Stephen Gran looked fine to me.
I don't think anything needs to be done.


BTW, the test case posted by Stephan Gran (sgran) does NOT fail for me.
grundler <523>gcc-3.4 -lm fptest.c -o test.3.4
grundler <524>gcc-4.0 -lm fptest.c -o test.4.0
grundler <525>./test.3.4
grundler <526>./test.4.0
grundler <527>

Here's what I get in the dmesg log instead of SIGBUS:
test.4.0(3857): unaligned access to 0x00000000bff4244c at ip=0x000000004044e9ff
test.4.0(3857): unaligned access to 0x00000000bff4244c at ip=0x000000004044ea03
test.4.0(3857): unaligned access to 0x00000000bff4243c at ip=0x000000004044ea07

N.b.: I don't have high confidence in this kernel outout:
o I should see 4 lines of output - one for each fstd op.
o unaligned addresses should be 8 bytes apart, incrementing.

And for the record:
grundler <566>uname -a
Linux gsyprf11.external.hp.com 2.6.14-rc2-pa2 #2 SMP Thu Sep 29 20:24:31 PDT 2005 parisc64 GNU/Linux

gcc version 3.4.5 20050706 (prerelease) (Debian 3.4.4-5)
gcc version 4.0.2 (Debian 4.0.2-2)


hth,
grant



Reply to: