NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: lib/39986: libmapper_zone.so is trying to call undefined weak symbol



The following reply was made to PR lib/39986; it has been noted by GNATS.

From: David Laight <david%l8s.co.uk@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc: 
Subject: Re: lib/39986: libmapper_zone.so is trying to call undefined weak 
symbol
Date: Fri, 1 Jan 2010 22:05:05 +0000

 Actually this has nothing to do with C++.
 The problem is that unloading libraries that are loaded with RTLD_GLOBAL
 is very dangerous.
 
 Compile these two functions into a.so and b.so:
 void a(void) {}
 void b(void) {a();}
 
 Then do:
        a = dlopen("a.so", RTLD_GLOBAL);
        b = dlopen("b.so", RTLD_GLOBAL);
        (void (*)(void)dlsym(b, "b"))();
        dlclose(a);
        (void (*)(void)dlsym(b, "b"))();
 Which then dies in b().
 
 For the case in question, the problem is the .fini() function.
 
        David
 
 -- 
 David Laight: david%l8s.co.uk@localhost
 


Home | Main Index | Thread Index | Old Index