mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] exec: Only allow a threaded init to exec from the thread_group_leader
@ 2006-01-29  6:18 Eric W. Biederman
  2006-01-29  8:36 ` Andrew Morton
  0 siblings, 1 reply; 10+ messages in thread
From: Eric W. Biederman @ 2006-01-29  6:18 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel

The weird things we do when we exec from a thread group are just ugly.
Those ugly things do not handle the case of init and I suspect
extending that code to properly support a threaded init would be just
hideous, and impossible to maintain. 

So just in case someone ever threads init return an error for the
unimplemented case.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>


---

 fs/exec.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

408dad0f2b7067b23929866150e73b2b2f12d662
diff --git a/fs/exec.c b/fs/exec.c
index 055378d..c9d8e31 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -600,6 +600,12 @@ static int de_thread(struct task_struct 
 	if (thread_group_empty(current))
 		goto no_thread_group;
 
+	/* A threaded init must exec from it's primary thread.
+	 * As the init task (i.e. child_reaper) may not exit.
+	 */
+	if (!thread_group_leader(current) && (current->tgid == 1))
+		return -EINVAL;
+	
 	/*
 	 * Kill all other threads in the thread group.
 	 * We must hold tasklist_lock to call zap_other_threads.
-- 
1.1.5.g3480


^ permalink raw reply	[flat|nested] 10+ messages in thread
[parent not found: <5AeeD-7xb-7@gated-at.bofh.it>]

end of thread, other threads:[~2006-01-30 20:41 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-01-29  6:18 [PATCH] exec: Only allow a threaded init to exec from the thread_group_leader Eric W. Biederman
2006-01-29  8:36 ` Andrew Morton
2006-01-29 10:25   ` Eric W. Biederman
2006-01-29 10:48     ` Andrew Morton
2006-01-29 15:24       ` Pavel Machek
2006-01-29 19:32         ` Andrew Morton
2006-01-29 21:32         ` Eric W. Biederman
2006-01-30  9:15     ` Jan Engelhardt
2006-01-30 20:41       ` Eric W. Biederman
     [not found] <5AeeD-7xb-7@gated-at.bofh.it>
     [not found] ` <5Aggm-1V6-3@gated-at.bofh.it>
     [not found]   ` <5AhYT-4uR-7@gated-at.bofh.it>
2006-01-29 13:36     ` Bodo Eggert

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®