On 10/12, Roland McGrath wrote: > > > No, the return calue from utrace_barrier() does not matter. And, if the > > tracee is killed we don't care. The race is different. > > The utrace_barrier return value should cover exactly the case you describe, > and that is the clean way to do it. It will fail if the tracee is either > dead or detached.
Ah, indeed!!! Thanks. > > But mostly I dislike the fact we must teach old and new engines to > > cooperate. > > We have some version of that regardless. Well, we never have 2 engines attached, but yes, we should reinitialize the engine if we are going to reuse it. > > And. probably I missed something, but it is not trivial to implement. > > A lot of problems to solve. Just for example, when we attach the new > > engine, its ->flag has no UTRACE_EVENT(SIGNAL) yet. If we steal ->siginfo > > we can "lose" this signal. If we set UTRACE_EVENT(SIGNAL) first, the new > > and old engine can race. > > This should be taken care of when you detach the old engine. If > utrace_control(task, old, UTRACE_DETACH) returns zero, then the old > engine's final callback has not run yet. Not sure. Suppose we call utrace_control(old, UTRACE_DETACH) right before the tracee utrace_get_signal() calls ops->report_signal(). utrace_control()->get_utrace_lock() succeeds, but when utrace_control() checks ->reporting it could be already cleared. > If it fails, then the old engine's callback has > run or is starting to run, Yes, and we can't know (afaics) whether UTRACE_SIGNAL_DELIVER was already returned or not. Oleg.