[DynInst_API:] Detaching process causes bus error


Date: Fri, 20 Sep 2013 00:59:14 +0800
From: Zifei Tong <soariez@xxxxxxxxx>
Subject: [DynInst_API:] Detaching process causes bus error
Hi,

I detach a mutatee process and let the mutator exit. When the mutatee
exit later on, it will run into a bus error and cause a core dump.

After reading the code, I think the problem is that after the mutator
process gone, the SIGBUS signal sent from DYNINSTbreakPoint() at
mutatee side is not correctly handled.

Is there any way to fix the bus error?

A very simple code snippet to reproduce this issue followed.

Thank you,
Zifei Tong

mutatee.c
---------------
int main()
{
    sleep(1);
}

mutator.cpp
-----------------
#include <dyninst/BPatch.h>

int main (int argc, const char* argv[])
{
    BPatch bpatch;
    BPatch_process *proc = bpatch.processAttach(argv[1], atoi(argv[2]));
    proc->detach(true);
}

run.sh
---------
#!/bin/bash
g++ mutator.cpp -ldyninstAPI -o mutator
gcc mutatee.c -o mutatee
./mutatee &
pid=$!
./mutator mutatee $pid

gdb backtrace
---------------------
#0  0x00007f0e80b52309 in syscall () from /usr/lib/libc.so.6
#1  0x00007f0e7f7d9cb0 in t_kill () from /usr/lib/libdyninstAPI_RT.so
#2  0x00007f0e7f7d9fd3 in DYNINSTbreakPoint () from /usr/lib/libdyninstAPI_RT.so
#3  0x00007f0e7f7db8fd in DYNINST_instExitEntry () from
/usr/lib/libdyninstAPI_RT.so
#4  0x00007f0e80e3c597 in ?? ()
#5  0x0001000100010000 in ?? ()
#6  0x0000000000000000 in ?? ()
[← Prev in Thread] Current Thread [Next in Thread→]
  • [DynInst_API:] Detaching process causes bus error, Zifei Tong <=