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]

Re: sleeping, locks and debug kernels


On Mon, Dec 12, 2011 at 05:58:51PM +0100, Oleg Nesterov wrote:
> On 12/12, David Smith wrote:
> >
> > On 12/12/2011 09:21 AM, Mark Wielaard wrote:
> >
> > > There is one issue I don't know how to solve. That is
> > > stap_start_task_finder() this takes a rcu_read_lock() goes over every
> > > task, inspects each, calls utrace_attach on it if appropriate, gets the
> > > task->mm, adds the engines to some internal datastructures, checks that
> > > unprivileged users don't get access to utrace engines of task that
> > > aren't theirs and then after doing that for each task releases the lock.
> > > The problem is that utrace_attach_task() may sleep, since it must
> > > allocate memory to create a new enginer. Which is not nice while we have
> > > the rcu_read_lock. But I don't immediately see how to split up this loop
> > > so that we only hold the lock while doing non-sleepy things.
> 
> Yes, this is the problem. Although I am not sure how "goes over every
> task" can work under rcu_read_lock() without races with clone(). For
> example, even "attach all threads in this thread group" is not simple.
> But this is off-topic.

Maybe off-topic, but it would be useful to know what the issues with
going over all threads while holding (or even while not holding)
rcu_read_lock. Do you have any pointers and/or recommendations?

> > I don't know how we could split up that loop.  Perhaps Oleg might have
> > some thoughts or might be persuaded to change the memory allocation
> > flags in utrace itself.
> 
> Yes, it is very simple to add UTRACE_ATTACH_CREATE_ATOMIC.

That would be useful I think.

Thanks,

Mark


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