This is the mail archive of the mailing list for the glibc project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Register a signal handler in _dl_start to handle SIGSEGV for dynamic linker

On Mon, Sep 1, 2008 at 8:16 PM, wuxi <> wrote:
> My problem is, when I hook signal handler at _dl_start (very start of the
> dynamic linker, according to my study of code) to enable taint tracking for
> dynamic linker, the special signal handler seems not work - that is, when I
> run, it reports Segment fault directly without trapping into my own
> signal handler. However, I dump the code and discover the hook function has
> been called before such access.

When asking a complex question please *also* post your patch to the
code. This allows the reviewer to read the patch, read your question,
and see if anything is missing.

> So, am I missing something here to register a signal handler for dynamic
> linker?

Yes. You should not be making function calls into libc *before* the
dynamic loader has relocated itself.

You must only install a signal handler after
elf/rtld.c (_dl_start) line 539 in libc cvs head
e.g.  bootstrap_map.l_relocated = 1;

Before this line it is not safe to make function calls into libc.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]