linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Prevent reuse of active thread group id
@ 2001-08-20 15:35 Dave McCracken
  2001-08-20 16:19 ` Alan Cox
  0 siblings, 1 reply; 2+ messages in thread
From: Dave McCracken @ 2001-08-20 15:35 UTC (permalink / raw)
  To: Linux Kernel


The thread group id of a task is initially assigned the value of that 
task's pid, then is inherited for each child task created with 
CLONE_THREAD.  This patch makes sure that the thread group id is never 
re-used as another task's pid as long as there's an active task with that 
tgid.

Patch is below.

Dave McCracken

======================================================================
Dave McCracken          IBM Linux Base Kernel Team      1-512-838-3059
dmccr@us.ibm.com                                        T/L   678-3059

====================

--- linux-2.4.9/./kernel/fork.c	Tue Jul 17 20:23:28 2001
+++ linux-2.4.9-tgid/./kernel/fork.c	Mon Aug 20 10:28:22 2001
@@ -101,6 +101,7 @@
 		for_each_task(p) {
 			if(p->pid == last_pid	||
 			   p->pgrp == last_pid	||
+			   p->tgid == last_pid	||
 			   p->session == last_pid) {
 				if(++last_pid >= next_safe) {
 					if(last_pid & 0xffff8000)


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

* Re: [PATCH] Prevent reuse of active thread group id
  2001-08-20 15:35 [PATCH] Prevent reuse of active thread group id Dave McCracken
@ 2001-08-20 16:19 ` Alan Cox
  0 siblings, 0 replies; 2+ messages in thread
From: Alan Cox @ 2001-08-20 16:19 UTC (permalink / raw)
  To: Dave McCracken; +Cc: Linux Kernel

> The thread group id of a task is initially assigned the value of that 
> task's pid, then is inherited for each child task created with 
> CLONE_THREAD.  This patch makes sure that the thread group id is never 
> re-used as another task's pid as long as there's an active task with that 
> tgid.

Looks a sensible precaution, otherwise a kill might go to very wrong places.
I'll apply it

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

end of thread, other threads:[~2001-08-20 16:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-08-20 15:35 [PATCH] Prevent reuse of active thread group id Dave McCracken
2001-08-20 16:19 ` Alan Cox

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).