This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug uprobes/10185] stap uprobe script on rawhide causes system crash


------- Additional Comments From jkenisto at us dot ibm dot com  2009-05-29 00:04 -------
(In reply to comment #1)
> The uprobes2 code in question reads thusly:
> 
> static void uprobe_free_task(struct uprobe_task *utask, bool in_callback)
> {
>         [...]
>         if (utask->engine && (utask->tsk != current || !in_callback)) {
>                 /*
>                  * No other tasks in this process should be running
>                  * uprobe_report_* callbacks.  (If they are, utrace_barrier()
>                  * here could deadlock.)
>                  */
>                 int result = utrace_control_pid(utask->pid, utask->engine,
>                                                                 UTRACE_DETACH);
>                         BUG_ON(result == -EINPROGRESS);
>         }
>         [...]
> 
> 

As I mentioned in 5/13 email to Srikar (which covered several topics), I think
that this is one place where we really do want to wait for all the other threads
to finish running their callbacks.  As mentioned, calling utrace_barrier() while
holding uproc->rwsem could deadlock.  But I think that something like the
following would work:
- In uproc_free_process():
	- While holding uproc->rwsem, set a flag in uproc to indicate that we're
shutting down uproc (because it has no more probes ? that's the only reason a
task would call uprobe_free_task() on a different task).  The shutting-down flag
means that no callbacks can make changes to uproc.
	- Unlock uproc->rwsem.
- In uprobe_free_task(), call utrace_control_pid(..., UTRACE_DETACH) and (if
necessary) utrace_barrier_pid() for the thread.
- Each uprobe_report_* callback would need to check uproc's shutting-down flag
after locking uproc->rwsem, and if uproc is shutting down, just unlock
uproc->rwsem and return.

-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=10185

------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]