dlsym() on implicit loaded symbols
Roland Dittel
Roland.Dittel at web.de
Fri Jul 14 16:51:17 UTC 2006
Hi all,
We have a issue with dlsym() on symbols imported by a library that was
loaded with dlopen(). Our code loads the libssl with dlopen() and then
do a dlsym() on several symbols. This works for all symbols exported by
libssl itself but fails for symbols exported by libcrypto. Libssl is
dynamically linked to libcrypto and should be loaded for libssl. I did
a truss and the FreeBSD loader loads libcrypto but does not read
anything from the file pointer.
This is the truss output:
<snip>
access("/prod/lib/fbsd-i386/libssl.so",0) = 0 (0x0)
open("/prod/lib/fbsd-i386/libssl.so",0x0,027757760020) = 3 (0x3)
fstat(3,0xbfbfe010) = 0 (0x0)
fstatfs(0x3,0xbfbfde30) = 0 (0x0)
read(3,"ELF ",4096) = 4096 (0x1000)
mmap(0x0,229376,(0x5)PROT_READ|PROT_EXEC,(0x20002)MAP_NOCORE|MAP_PRIVATE
,3,0x0) = 674971648 (0x283b4000)
mprotect(0x283e7000,4096,(0x7)PROT_READ|PROT_WRITE|PROT_EXEC) = 0 (0x0)
mprotect(0x283e7000,4096,(0x5)PROT_READ|PROT_EXEC) = 0 (0x0)
mmap(0x283e8000,16384,(0x3)PROT_READ|PROT_WRITE,(0x12)MAP_FIXED|MAP_PRIV
ATE,3,0x33000) = 675184640 (0x283e8000)
close(3) = 0 (0x0)
access("/prod/lib/fbsd-i386/libcrypto.so.0.9.8",0) = 0 (0x0)
open("/prod/lib/fbsd-i386/libcrypto.so.0.9.8",0x0,05005664564) = 3 (0x3)
fstat(3,0xbfbfdfe0) = 0 (0x0)
close(3) = 0 (0x0)
mmap(0x0,5528,(0x3)PROT_READ|PROT_WRITE,(0x1000)MAP_ANON,-1,0x0) =
675201024 (0x283ec000)
munmap(0x283ec000,5528) = 0 (0x0)
</snip>
On solaris, linux and irix the same code works fine and the libcrypto
symbols are implicit loaded and usable. Does anyone know why FreeBSD
behaves differently that other Unixes?
Thanks,
Roland
More information about the freebsd-hackers
mailing list