Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 24 Aug 1999 15:00:00 +0200
From:      Marcel Moolenaar <marcel@scc.nl>
To:        emulation@FreeBSD.ORG
Subject:   SIGBUS for threaded Linux binaries (glibc2.1) [PSL_AC related?]
Message-ID:  <37C2974F.60536A3C@scc.nl>

next in thread | raw e-mail | index | archive | help
Hi,

I'm having a problem (well, multiple :-), but this one is related to
threaded Linux binaries, using glibc2.1 libraries. Let's pick such a
binary: StarOffice 5.1

When SO5.1 is run with glibc2, all is fine. But when run with glibc2.1
SO5.1 SIGBUSes. A gdb(1) session reveals that the SIGBUS occurs in
pthread_initialize(). A fragment is given below:

0x28118f4b <pthread_initialize+39>:     pushf  
0x28118f4c <pthread_initialize+40>:     popl   %edx
0x28118f4d <pthread_initialize+41>:     movl   %edx,%eax
0x28118f4f <pthread_initialize+43>:     xorl   $0x40000,%eax
0x28118f54 <pthread_initialize+48>:     pushl  %eax
0x28118f55 <pthread_initialize+49>:     popf   
0x28118f56 <pthread_initialize+50>:     pushf  
0x28118f57 <pthread_initialize+51>:     popl   %eax
0x28118f58 <pthread_initialize+52>:     xorl   %edx,%eax
0x28118f5a <pthread_initialize+54>:     andl   $0x40000,%eax
0x28118f5f <pthread_initialize+59>:     pushl  %edx
0x28118f60 <pthread_initialize+60>:     popf   
0x28118f61 <pthread_initialize+61>:     testl  %eax,%eax
0x28118f63 <pthread_initialize+63>:     setne  %dl

gdb(1) tells me:
Program terminated with signal 10, Bus error.
#0  0x28118f56 in ?? ()

What this piece of code does (IINM) is toggle the AC (Alignment Check) bit
in the flags register and verifies that it has changed and sets %dl to
reflect that.

From looking at /sys/i386/psl.h I conclude that AC is off by default and
that the piece of code sets the bit. The comment in psl.h says:

	[snip] Changes to PSL_AC are silently ignored on 386's.

Which tends me to think that they are not ignored on 486 and up.

Am I correct in concluding that changing PSL_AC is responsible for the
SIGBUS?
[if not, then skip to end of mail]

IINM then Linux has PSL_AC set by default (see arch/i386/kernel/vm86.c) for
486 and up. This means that the code fragment given above clears that bit.
This doesn't seem to give any problems, because SO5.1 works on Linux (duh
:-)

Is the SIGBUS avoided if we also have PSL_AC in FreeBSD by default?
Are there any reasons why we couldn't set PSL_AC in FreeBSD by default?

Thoughts?

-- 
Marcel Moolenaar                                  mailto:marcel@scc.nl
SCC Internetworking & Databases                     http://www.scc.nl/
Amsterdam, The Netherlands                         tel: +31 20 4200655


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-emulation" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?37C2974F.60536A3C>