Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 302 by [email protected]: Add ability to forward SEGVs to ASAN handler
http://code.google.com/p/address-sanitizer/issues/detail?id=302

Hi,

I have a program that intercepts some SEGV and, as such, is incompatible with handle_segv=1 from ASan. However, when my handler detects a SEGV it does not handle, it would be nice to be able to forward the signal to ASAN's SEGV handler in order to get a clean report about the issue.

A quick workaround currently is to always register the handler in ASAN, and only take care of the handle_segv=1 in the signal/sigaction overloading:

diff --git a/lib/asan/asan_posix.cc b/lib/asan/asan_posix.cc
index bcc6b38..e60c2dc 100644
--- a/lib/asan/asan_posix.cc
+++ b/lib/asan/asan_posix.cc
@@ -36,8 +36,6 @@ namespace __asan {

 static void MaybeInstallSigaction(int signum,
void (*handler)(int, siginfo_t *, void *)) {
-  if (!AsanInterceptsSignal(signum))
-    return;
   struct sigaction sigact;
   REAL(memset)(&sigact, 0, sizeof(sigact));
   sigact.sa_sigaction = handler;

Then, in the application code, we could do:

 my_handler(int, siginfo, void*) {
    do_stuff();
    if (signal_not_handled) {
        forward_action(signo, si, ptr);
    }
 }

 sigaction(SEGV, my_act, prev_act)
 forward_action = prev_act.sa_action;

However, this is a problem since we have to forward all the parameters properly.

--
You received this message because this project is configured to send all issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

--
You received this message because you are subscribed to the Google Groups 
"address-sanitizer" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to