Subject: pkg/18145: freebsd_lib and ld.so.hints
To: None <gnats-bugs@gnats.netbsd.org>
From: None <netbsd@precedence.co.uk>
List: netbsd-bugs
Date: 09/02/2002 10:13:04
>Number:         18145
>Category:       pkg
>Synopsis:       freebsd_lib package needs ld.so.hints file to stop SIGFPE
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Sep 02 02:14:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Stephen Borrill
>Release:        NetBSD 1.5.3
>Organization:
Precedence Technologies Ltd
>Environment:
Affects 1.5 through to 1.6 and -current
System: NetBSD newbuild 1.5.3 NetBSD 1.5.3 (CLACKS3) #0: Fri Aug 30 11:19:58 BST 2002 root@mailserver:/usr/src/sys/arch/i386/compile/CLACKS3 i386

>Description:
Trying to run a FreeBSD binary with the freebsd_lib package often gives a
SIGFPE immediately. Using ktrace showed that this was due to
/var/run/ld.so.hints being used for the FreeBSD a.out binaries. On a basic
ELF i386 system the /var/run/ld.so.hints file contains a small amount of
data generated by ldconfig at boot time. This causes the SIGFPE. Creating a
zero-length ld.so.hints file or adding the 1.4 a.out compatibility package
(to generate more data in ld.so.hints) stops the error. Due to the way
emulation works, /var/run/ld.so.hints is only used if
/emul/freebsd/var/run/ld.so.hints is not found, so this gives us a simple
workaround.

>How-To-Repeat:
On a clean 1.6 i386 install (i.e. do NOT install any a.out compatibility
packages), add the freebsd_lib-2.2.7 package. Then try to run a FreeBSD 2
a.out binary (Sophos antivirus was used for testing:
http://www.sophos.com/downloads/products/unix_2063.html ). The program
will die with a floating exception. Now type:

mkdir -p /emul/freebsd/var/run
touch /emul/freebsd/var/run/ld.so.hints

The program will now run successfully.

>Fix:
Add an empty file in /usr/pkg/emul/freebsd/var/run/ld.so.hints
>Release-Note:
>Audit-Trail:
>Unformatted: