From owner-freebsd-hackers@FreeBSD.ORG Fri Jul 14 16:51:17 2006 Return-Path: X-Original-To: hackers@freebsd.org Delivered-To: freebsd-hackers@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B86EF16A51E for ; Fri, 14 Jul 2006 16:51:17 +0000 (UTC) (envelope-from Roland.Dittel@web.de) Received: from fmmailgate02.web.de (fmmailgate02.web.de [217.72.192.227]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2114C43D45 for ; Fri, 14 Jul 2006 16:51:17 +0000 (GMT) (envelope-from Roland.Dittel@web.de) Received: from smtp05.web.de (fmsmtp05.dlan.cinetic.de [172.20.4.166]) by fmmailgate02.web.de (Postfix) with ESMTP id 877818CA7FF for ; Fri, 14 Jul 2006 18:51:15 +0200 (CEST) Received: from [88.64.224.55] (helo=freebsd.localnet) by smtp05.web.de with asmtp (TLSv1:AES256-SHA:256) (WEB.DE 4.107 #114) id 1G1Qsk-0004gD-00 for hackers@freebsd.org; Fri, 14 Jul 2006 18:51:14 +0200 Received: from [192.168.99.21] (apple.localnet [192.168.99.21]) by freebsd.localnet (8.13.6/8.13.1) with ESMTP id k6EGpACJ044877 for ; Fri, 14 Jul 2006 18:51:10 +0200 (CEST) (envelope-from Roland.Dittel@web.de) Mime-Version: 1.0 (Apple Message framework v624) Content-Transfer-Encoding: quoted-printable Message-Id: <62d3f75eb4400604406fdea341d91e41@web.de> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed To: hackers@freebsd.org From: Roland Dittel Date: Fri, 14 Jul 2006 18:51:08 +0200 X-Mailer: Apple Mail (2.624) Sender: Roland.Dittel@web.de X-Sender: Roland.Dittel@web.de Cc: Subject: dlsym() on implicit loaded symbols X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Jul 2006 16:51:17 -0000 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: 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) 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