Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 26 Mar 2000 11:04:08 -0600
From:      "Richard Seaman, Jr." <dick@tar.com>
To:        Arun Sharma <adsharma@sharmas.dhs.org>
Cc:        FreeBSD Hackers <freebsd-hackers@FreeBSD.ORG>
Subject:   Re: RTLD thread safety
Message-ID:  <20000326110408.A378@tar.com>
In-Reply-To: <20000325225615.A11307@sharmas.dhs.org>; from adsharma@sharmas.dhs.org on Sat, Mar 25, 2000 at 10:56:15PM -0800
References:  <20000325225615.A11307@sharmas.dhs.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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




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