Re: [PATCH v2 7/11] Uprobes Implementation

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Oleg Nesterov
Date: Tuesday, April 13, 2010 - 11:35 am

On 03/31, Srikar Dronamraju wrote:

Looks like, this doesn't need get/put task_struct, you could just
use pid_task() under rcu_read_lock().


This doesn't look right. We can't trust ->thread_group list even under
rcu_read_lock(). The task can exit and __exit_signal() can remove it
from ->thread_group list before we take rcu_read_lock().


This is called by create_uprocess(). Who will free t->utask if t has
already passed tracehook_report_exit() ?


not sure I understand this check. Somehow we should prevent the races
with tracehook_report_exit/tracehook_report_exec, but PF_EXITING can't
help ?


again, this doesn't look right. Btw, I'd suggest to use while_each_thread().


can't we race with clone(CLONE_THREAD) and miss the new thread? Probably
I missed something, but afaics we need some barriers to ensure that either
tracehook_report_clone() sees current->utask != NULL or find_next_thread()
sees the new thread in ->thread_group.


Is it really possible to call register/unregister with nsproxy == NULL?


Why do we check PF_EXITING?


OK, uproc and p can't go away. But why it is safe to use pid_task(p) ?

I am looking at 6th patch http://marc.info/?l=linux-kernel&m=127005086102256
and xol_validate_vaddr() calls pid_task() without rcu and doesn't check
the result is not NULL.

We already dropped uprobe_mutex, can't this task exit?


This looks a bit strange. Why do we need "ctask" at all? It is not used,
you could just do

	if (likely(!child->utask))
		add_utask(child, uproc);

The same for "else" branch.


OK, iiuc this should restore the original instruction, right?

But what about clone(CLONE_VM)? In this case this child shares ->mm with
parent.

Oleg.

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH v2 0/11] Uprobes patches., Srikar Dronamraju, (Wed Mar 31, 8:51 am)
[PATCH v2 1/11] Move Macro W to insn.h, Srikar Dronamraju, (Wed Mar 31, 8:51 am)
[PATCH v2 2/11] Move replace_page() to mm/memory.c, Srikar Dronamraju, (Wed Mar 31, 8:51 am)
[PATCH v2 3/11] Enhance replace_page() to support pagecache, Srikar Dronamraju, (Wed Mar 31, 8:51 am)
[PATCH v2 4/11] User Space Breakpoint Assistance Layer, Srikar Dronamraju, (Wed Mar 31, 8:51 am)
[PATCH v2 5/11] X86 details for user space breakpoint assi ..., Srikar Dronamraju, (Wed Mar 31, 8:52 am)
[PATCH v2 6/11] Slot allocation for Execution out of line, Srikar Dronamraju, (Wed Mar 31, 8:52 am)
[PATCH v2 7/11] Uprobes Implementation, Srikar Dronamraju, (Wed Mar 31, 8:52 am)
[PATCH v2 8/11] X86 details for uprobes., Srikar Dronamraju, (Wed Mar 31, 8:52 am)
[PATCH v2 9/11] Uprobes Documentation patch, Srikar Dronamraju, (Wed Mar 31, 8:52 am)
[PATCH v2 10/11] Uprobes samples., Srikar Dronamraju, (Wed Mar 31, 8:52 am)
[PATCH v2 11/11] Uprobes traceevents patch., Srikar Dronamraju, (Wed Mar 31, 8:53 am)
Re: [PATCH v2 11/11] Uprobes traceevents patch., Steven Rostedt, (Wed Mar 31, 2:24 pm)
Re: [PATCH v2 11/11] Uprobes traceevents patch., Masami Hiramatsu, (Wed Mar 31, 9:16 pm)
Re: [PATCH v2 7/11] Uprobes Implementation, Oleg Nesterov, (Tue Apr 13, 11:35 am)
Re: [PATCH v2 7/11] Uprobes Implementation, Srikar Dronamraju, (Thu Apr 15, 2:35 am)
Re: [PATCH v2 7/11] Uprobes Implementation, Oleg Nesterov, (Mon Apr 19, 12:31 pm)
Re: [PATCH v2 7/11] Uprobes Implementation, Srikar Dronamraju, (Tue Apr 20, 5:43 am)
Re: [PATCH v2 7/11] Uprobes Implementation, Oleg Nesterov, (Tue Apr 20, 8:30 am)
Re: [PATCH v2 7/11] Uprobes Implementation, Srikar Dronamraju, (Tue Apr 20, 11:59 pm)
Re: [PATCH v2 7/11] Uprobes Implementation, Oleg Nesterov, (Wed Apr 21, 9:05 am)
Re: [PATCH v2 7/11] Uprobes Implementation, Srikar Dronamraju, (Thu Apr 22, 6:31 am)
Re: [PATCH v2 7/11] Uprobes Implementation, Oleg Nesterov, (Thu Apr 22, 8:40 am)
Re: [PATCH v2 7/11] Uprobes Implementation, Srikar Dronamraju, (Fri Apr 23, 7:58 am)
Re: [PATCH v2 7/11] Uprobes Implementation, Oleg Nesterov, (Fri Apr 23, 11:53 am)
Re: [PATCH v2 7/11] Uprobes Implementation, Peter Zijlstra, (Tue May 11, 1:32 pm)
Re: [PATCH v2 7/11] Uprobes Implementation, Peter Zijlstra, (Tue May 11, 1:43 pm)
Re: [PATCH v2 7/11] Uprobes Implementation, Peter Zijlstra, (Tue May 11, 1:44 pm)
Re: [PATCH v2 7/11] Uprobes Implementation, Peter Zijlstra, (Tue May 11, 1:45 pm)
Re: [PATCH v2 7/11] Uprobes Implementation, Peter Zijlstra, (Tue May 11, 1:47 pm)
Re: [PATCH v2 7/11] Uprobes Implementation, Frank Ch. Eigler, (Tue May 11, 1:57 pm)
Re: [PATCH v2 7/11] Uprobes Implementation, Peter Zijlstra, (Tue May 11, 2:01 pm)
Re: [PATCH v2 7/11] Uprobes Implementation, Srikar Dronamraju, (Wed May 12, 3:31 am)
Re: [PATCH v2 7/11] Uprobes Implementation, Srikar Dronamraju, (Wed May 12, 3:41 am)
Re: [PATCH v2 11/11] Uprobes traceevents patch., Frederic Weisbecker, (Wed May 12, 4:02 am)
Re: [PATCH v2 7/11] Uprobes Implementation, Peter Zijlstra, (Wed May 12, 4:12 am)
Re: [PATCH v2 7/11] Uprobes Implementation, Srikar Dronamraju, (Wed May 12, 7:24 am)
Re: [PATCH v2 11/11] Uprobes traceevents patch., Srikar Dronamraju, (Wed May 12, 7:34 am)
Re: [PATCH v2 11/11] Uprobes traceevents patch., Frederic Weisbecker, (Wed May 12, 7:57 am)
Re: [PATCH v2 11/11] Uprobes traceevents patch., Frederic Weisbecker, (Wed May 12, 8:15 am)
Re: [PATCH v2 7/11] Uprobes Implementation, Oleg Nesterov, (Thu May 13, 12:40 pm)
Re: [PATCH v2 7/11] Uprobes Implementation, Linus Torvalds, (Thu May 13, 12:59 pm)
Re: [PATCH v2 7/11] Uprobes Implementation, Andi Kleen, (Thu May 13, 3:12 pm)
Re: [PATCH v2 7/11] Uprobes Implementation, Linus Torvalds, (Thu May 13, 3:25 pm)
Re: [PATCH v2 7/11] Uprobes Implementation, Roland McGrath, (Thu May 13, 5:56 pm)
Re: [PATCH v2 7/11] Uprobes Implementation, Srikar Dronamraju, (Thu May 13, 10:42 pm)