I am  writing a tool that controls the behavior of a controlled
process (C) from two other processes: Master1 and Master2. I am using
libpctx for this, and I am getting the behavior that I do not understand.
Here is what happens.

Master1 writes a control message in C's /proc/pid/ctl file, to trace and
catch SIGEMT (a signal emitted when a hardware program counter overflows).
Then Master1, waits for C to stop (by writing PCWSTOP control message into
its control file). If C stops on SIGEMT, Master1 clears the signal and
sets C running again.

Master2 captures C by calling pctx_capture and sets C's hardware counter
to count instructions. Then it lets C run by calling pctx_run.

When C's instruction counter overflows, C is sent SIGEMT signal. As a
result C dies (because C itself does not have a signal handler for
SIGEMT). However, I would expect that Master1 would catch and clear that
signal. But this is not happening. When I run only Master1 and C and send
SIGEMT to C via the "kill" command, Master1 is catching and clearing that
signal. But when I run Master2 along with Master1 and C, the signal is not
delivered to Master1.

In fact, the signal is delivered to C, because before C dies, a message
"EMT trap" is printed in the shell where the process was running.

My guess is that pctx library (running Master2) modifies C's signal mask,
preventing SIGEMT to be handled by Master1. Or perhaps the system does not
like that C is being traced by two different processes.

Any ideas why the above behavior is happening? Any ideas how to work
around it?
 
 
This message posted from opensolaris.org
_______________________________________________
opensolaris-code mailing list
opensolaris-code@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code

Reply via email to