mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* rfc, leader_pid_type()
@ 2008-03-18 15:38 Oleg Nesterov
       [not found] ` <m18x0fvh5d.fsf@ebiederm.dsl.xmission.com>
  0 siblings, 1 reply; 4+ messages in thread
From: Oleg Nesterov @ 2008-03-18 15:38 UTC (permalink / raw)
  To: Eric W. Biederman, Pavel Emelyanov; +Cc: linux-kernel

Eric, Pavel.

Without tasklist lock held, task_tgid/task_pgrp/task_session can return the
bogus NULL. Note that the last 2 can return NULL even if task == current.

What do you think if we add yet another helper?

	struct pid *leader_pid_type(struct task_struct *task, enum pid_type type)
	{
		struct pid *ret;
	retry:
		ret = task->group_leader->pids[type].pid;
		if (likely(ret != NULL) || !pid_alive(task))
			return ret;
		/*
		 * We hit the old leader in the middle of de_thread(),
		 * or setsid/setpgrp is in progress.
		 */
		cpu_relax();
		goto retry;
	}

Yes, we already have a lot helpers... The one potential user is
check_kill_permission(), but it can live without it.

What do you think, do you see other possible users? Say, do_task_stat() may
report sid = 0, but this is minor of course...

Oleg.	


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-03-19 23:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-03-18 15:38 rfc, leader_pid_type() Oleg Nesterov
     [not found] ` <m18x0fvh5d.fsf@ebiederm.dsl.xmission.com>
2008-03-18 22:15   ` Oleg Nesterov
     [not found]     ` <m13aqnvdnk.fsf@ebiederm.dsl.xmission.com>
2008-03-19  0:31       ` Oleg Nesterov
2008-03-19 14:36         ` Oleg Nesterov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®