From owner-freebsd-hackers Sun Mar 26 9: 4:42 2000 Delivered-To: freebsd-hackers@freebsd.org Received: from test.tar.com (test.tar.com [204.95.187.4]) by hub.freebsd.org (Postfix) with ESMTP id BDD9437B809 for ; Sun, 26 Mar 2000 09:04:16 -0800 (PST) (envelope-from dick@test.tar.com) Received: (from dick@localhost) by test.tar.com (8.9.3/8.9.3) id LAA02735; Sun, 26 Mar 2000 11:04:08 -0600 (CST) (envelope-from dick) Date: Sun, 26 Mar 2000 11:04:08 -0600 From: "Richard Seaman, Jr." To: Arun Sharma Cc: FreeBSD Hackers Subject: Re: RTLD thread safety Message-ID: <20000326110408.A378@tar.com> References: <20000325225615.A11307@sharmas.dhs.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0.1i In-Reply-To: <20000325225615.A11307@sharmas.dhs.org>; from adsharma@sharmas.dhs.org on Sat, Mar 25, 2000 at 10:56:15PM -0800 Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Sat, Mar 25, 2000 at 10:56:15PM -0800, Arun Sharma wrote: > When I try to compile a simple multi threaded program using a wrapper > around rfork (from linuxthreads port), I get the following core dump: > > ld-elf.so.1: assert failed: /usr/src/libexec/rtld-elf/lockdflt.c:54 > > Investigation into code reveals that lazy resolution of symbols > (using PLTs) was happening in multiple threads in the linker simultaneously. > > Also, the code in lockdflt.c is achieving mutual exclusion by blocking > signals. This doesn't work on a SMP machine using kernel threads. > > What would be the right solution for this ? A new set of primitives > registered using dllockinit or making the defaults SMP thread-safe ? > > I suppose the linuxthreads port works because it has been tested only > with Linux executables and Linux executables don't use lazy resolution > of symbols ? I'm just speculating here. No. See the file libc_thread.c in the linuxthreads port. Note that if you call rfork (RF_MEM...) without any supporting infrastructure (eg. as provided by the linuxthreads port) you are in dangerous territory. You do not get *any* of the thread safe behaviour in libc, libgcc, or in ld-ef.so. -- Richard Seaman, Jr. email: dick@tar.com 5182 N. Maple Lane phone: 262-367-5450 Chenequa WI 53058 fax: 262-367-5852 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message