This is the mail archive of the
libc-help@sourceware.org
mailing list for the glibc project.
Register a signal handler in _dl_start to handle SIGSEGV for dynamiclinker
- From: wuxi <wu dot andrew dot xi at gmail dot com>
- To: glibc-help <libc-help at sourceware dot org>
- Date: Tue, 02 Sep 2008 08:16:10 +0800
- Subject: Register a signal handler in _dl_start to handle SIGSEGV for dynamiclinker
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:subject:content-type :content-transfer-encoding; bh=M+YTFFPtj4dmUR9AjPxQ13yj2o+2IxkNRB2NzJjZUsM=; b=LQybBh69P5OHwHm79T7HHtQqeCe/HH5lqut1xIyLrU6wI2WRTLVxoMPH/rD3m5SJtF FfbFQNuJ4S55UcyQFjqDva9W2+9kR6QxVsL0IhBC0nIF7BoEABZ4Uu9FsKyPuFxc+H+b 02ys/UdR5two4+FxykMGrdyTyGQN3xL8tiEvw=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; b=cJbkIbeolT7zSmmclVLPivzyMjljHaTbQn6BgWVqgMXCmBi7bNn4VgiFSLcJcsOvXG qW1vKxlMs3kVwShTa3nPPA6L9w+xLXqcUolhGn+VL5bE0A69soWdRUiRWWNvlWftZxzX nFopN+wbV8uG6co1xivw8HuV4XecpDk34rqto=
Hi
I am doing a research project on IA-64 and glibc-2.5. My goal is to do
instrumentation to enable whole-program (including those functions in
library, or dynamic linker) taint tracking.
For that purpose, I need to register a special handler to handle SIGSEGV
at the very start of any program, for I use unmapped area as the bitmap
for taint tracking (more specifically, 0x0 ~ 0x1000000000000000 on
Itanium).
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 ld.so, 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.
The code to register the signal handler is shown below:
===================================================
int oldact_saved = shift_sigaction(SIGSEGV, NULL, &oldact);
act.sa_handler = NULL;
act.sa_sigaction = B_sigaction;
act.sa_mask = oldact.sa_mask;
act.sa_flags = SA_SIGINFO;
int newact_reged = shift_sigaction(SIGSEGV, &act, NULL);
===================================================
BTW. I use gdb to debug the ld.so, but gdb cannot stop at the break
points ...
So, am I missing something here to register a signal handler for dynamic
linker?
Thanks
yours sincerely
Andrew