This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
[Bug uprobes/10185] stap uprobe script on rawhide causes system crash
- From: "jkenisto at us dot ibm dot com" <sourceware-bugzilla at sourceware dot org>
- To: systemtap at sources dot redhat dot com
- Date: 29 May 2009 00:04:08 -0000
- Subject: [Bug uprobes/10185] stap uprobe script on rawhide causes system crash
- References: <20090522092834.10185.ananth@in.ibm.com>
- Reply-to: sourceware-bugzilla at sourceware dot org
------- 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.