bug-hurd
[Top][All Lists]
Advanced

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

Re: Bug#88690: mtrace triggers SIGBUS at first malloc


From: Mark Kettenis
Subject: Re: Bug#88690: mtrace triggers SIGBUS at first malloc
Date: Thu, 8 Mar 2001 20:44:13 +0100

   From: Marcus Brinkmann <Marcus.Brinkmann@ruhr-uni-bochum.de>
   Date: Wed, 7 Mar 2001 19:39:51 +0100

   So I think this might have something to do with what _cthread_init_routine
   does, or with the special code in libc/sysdeps/mach/hurd/i386/init-first
   when this function is defined. I don't understand this code at all, and I
   have no idea how to debug it any further than that.

What!  You don't understand Roland's overly clever stack-munging code :-).

Seriously, what _cthread_init_routine does is allocating a new stack
for the initial thread.  Then the code in sysdeps/mach/hurd/i386/init-first.c 
copies some stuff (such as the program arguments and environment) from
the old stack to the new one, switches to the new stack, and then
frees the old stack.

However the dynamic linker keeps a pointer to the old program
arguments in _dl_argv.  Now when mtrace() calls _dl_addr() it looks at
_dl_argv[0], which points somewhere in the deallocated stack which
results in your SIGBUS.

Unfortunately, I'm not sure how to fix this yet.

Mark



reply via email to

[Prev in Thread] Current Thread [Next in Thread]