Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 14 Jul 2006 18:51:08 +0200
From:      Roland Dittel <Roland.Dittel@web.de>
To:        hackers@freebsd.org
Subject:   dlsym() on implicit loaded symbols
Message-ID:  <62d3f75eb4400604406fdea341d91e41@web.de>

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

We have a issue with dlsym() on symbols imported by a library that was =20=

loaded with dlopen(). Our code loads the libssl with dlopen() and then =20=

do a dlsym() on several symbols. This works for all symbols exported by =20=

libssl itself but fails for symbols exported by libcrypto. Libssl is =20
dynamically linked to libcrypto and should be loaded for libssl. I did =20=

a truss and the FreeBSD loader loads libcrypto but does not read =20
anything from the file pointer.

This is the truss output:
<snip>
access("/prod/lib/fbsd-i386/libssl.so",0) =3D 0 (0x0)
open("/prod/lib/fbsd-i386/libssl.so",0x0,027757760020) =3D 3 (0x3)
fstat(3,0xbfbfe010)                              =3D 0 (0x0)
fstatfs(0x3,0xbfbfde30)                          =3D 0 (0x0)
read(3,"=7FELF=01=01=01 ",4096)                          =3D 4096 =
(0x1000)
mmap(0x0,229376,(0x5)PROT_READ|PROT_EXEC,(0x20002)MAP_NOCORE|MAP_PRIVATE=20=

,3,0x0) =3D 674971648 (0x283b4000)
mprotect(0x283e7000,4096,(0x7)PROT_READ|PROT_WRITE|PROT_EXEC) =3D 0 =
(0x0)
mprotect(0x283e7000,4096,(0x5)PROT_READ|PROT_EXEC) =3D 0 (0x0)
mmap(0x283e8000,16384,(0x3)PROT_READ|PROT_WRITE,(0x12)MAP_FIXED|MAP_PRIV=20=

ATE,3,0x33000) =3D 675184640 (0x283e8000)
close(3)                                         =3D 0 (0x0)
access("/prod/lib/fbsd-i386/libcrypto.so.0.9.8",0) =3D 0 (0x0)
open("/prod/lib/fbsd-i386/libcrypto.so.0.9.8",0x0,05005664564) =3D 3 =
(0x3)
fstat(3,0xbfbfdfe0)                              =3D 0 (0x0)
close(3)                                         =3D 0 (0x0)
mmap(0x0,5528,(0x3)PROT_READ|PROT_WRITE,(0x1000)MAP_ANON,-1,0x0) =3D =20
675201024 (0x283ec000)
munmap(0x283ec000,5528)                          =3D 0 (0x0)
</snip>

On solaris, linux and irix the same code works fine and the libcrypto =20=

symbols are implicit loaded and usable. Does anyone know why FreeBSD =20
behaves differently that other Unixes?

Thanks,
Roland




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?62d3f75eb4400604406fdea341d91e41>