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

Bug#205234: 2.3.2-7 + pthread + vsyslog()



On Thu, Sep 18, 2003 at 11:36:48PM +0100, Philip Blundell wrote:
> On Thu, 2003-09-18 at 13:39, Daniel Jacobowitz wrote:
> > What were you debugging when you encountered this, and what was loading
> > libpthread?  In general, this won't work.  The problem is that syslog
> > tries to lock a mutex; but the mutex was never initialized because
> > libpthread was not loaded until later.
> 
> As far as I can tell, the cause of the problem here is that the openlog
> cleanup handler is not being called, leaving the mutex locked on exit
> from that function.  That in turn happens because __libc_cleanup_push
> finds that the GOT entry for _pthread_cleanup_push is NULL, leading it
> to believe that libpthread isn't loaded.
> 
> I'll try adding these functions to __libc_pthread_functions and see if
> that helps.

Very interesting, very interesting.  Take a look at libc.so.6:

drow@nevyn:~/deb-cvs/glibc-2.3.2/i386-linux/obj% objdump -T /lib/libc.so.6| grep pthread_cleanup_push
00000000  w   D  *UND*  00000000	      _pthread_cleanup_push_defer
00000000  w   D  *UND*  00000000              _pthread_cleanup_push
drow@nevyn:~/deb-cvs/glibc-2.3.2/i386-linux/obj% objdump -R /lib/libc.so.6| grep pthread_cleanup_push
0012b234 R_386_GLOB_DAT    _pthread_cleanup_push_defer
0012b270 R_386_GLOB_DAT    _pthread_cleanup_push
0012b0bc R_386_JUMP_SLOT   _pthread_cleanup_push_defer
0012b0e0 R_386_JUMP_SLOT   _pthread_cleanup_push

Then in GDB, stopped in openlog:
(gdb) x/x 0x40019000  + 0x0012b270
0x40144270:     0x00000000

(gdb) x/3i 0x4002ebb6
0x4002ebb6:     push   $0x1b8
0x4002ebbb:     jmp    0x4002e830
0x4002ebc0:     jmp    *0xec(%ebx)

OK, one is the PLT reference, the other is the global data.  Shouldn't
that global data be fixed up by the loader?

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer



Reply to: