Re: [PATCH 1/3] comm: Introduce comm_lock seqlock to protecttask->comm access

From: John Stultz
Date: Mon May 16 2011 - 21:49:43 EST


On Tue, 2011-05-17 at 00:01 +0200, Jiri Slaby wrote:
> On 05/16/2011 11:19 PM, John Stultz wrote:
> > diff --git a/include/linux/init_task.h b/include/linux/init_task.h
> > index caa151f..b69d94b 100644
> > --- a/include/linux/init_task.h
> > +++ b/include/linux/init_task.h
> > @@ -161,6 +161,7 @@ extern struct cred init_cred;
> > .group_leader = &tsk, \
> > RCU_INIT_POINTER(.real_cred, &init_cred), \
> > RCU_INIT_POINTER(.cred, &init_cred), \
> > + .comm_lock = __SPIN_LOCK_UNLOCKED(tsk.comm_lock), \
>
> Hmm, you should also init the spinlock somewhere in copy_process.
> Otherwise when a process is forked in the middle of [gs]et_task_comm
> called on it on another cpu, you have two locked locks and only the
> parent's will be unlocked, right?

Ah, yep. Fixed for the next version.

thanks!
-john

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/