Re: [PATCH] Fixes for RCU handling of task_struct

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"Paul E. McKenney" wrote:
> 
> > > +       while (p->group_leader != p)
> > > +               p = p->group_leader;
> >
> > No, this is definitely not right. de_thread() does not change leader->group_leader
> > when non-leader execs, so p->group_leader == p always.
> 
> This was intended for the case where the group leader does pthread_exit,
> which would cause some other thread to assume group leadership.  Or am
> I missing something from that code path?  (Quite likely that I am...)

When group leader exits it goes into TASK_ZOMBIE state (if it is not the
only one thread in the same group). It is still the ->group_leader for all
threads including itself. Only when release_task(last_thread_in_thread_group)
happens, it will notice not yet released group_leader, and release it, see
'repeat:' patch in release_task().

The ->group_leader is changed only when non-leader thread does exec, it kills
other threads and becomes ->group_leader for itself.

So, I think send_group_sigqueue() should do:

	read_lock(tasklist_lock);

	if (!tsk->signal) {
		// Can happen only if de_thread did release_task(tsk)
		// while switching to new leader.
		// We can't figure out the new leader, but it does not
		// matter - we should drop the signal anyway.
		unlock(tasklist);
		return;
	}

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

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux