Subject: [PATCH] Don't allow a threaded init to exec off the non-primary thread From: Eric W. Biederman Date: 1130566854 -0600 There are references to the init that would be broken if init could exec. --- fs/exec.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) c2c83bcafe805cec4fc261ea919b1a6d552613c5 diff --git a/fs/exec.c b/fs/exec.c index c9001c2..d1cf4ad 100644 --- a/fs/exec.c +++ b/fs/exec.c @@ -613,6 +613,13 @@ static inline int de_thread(struct task_ if (thread_group_empty(current)) goto no_thread_group; + /* It isn't safe to kill the pspace leader don't allow it. + * To be safe this code would need to start executing in the thread + * group leader. + */ + if (!thread_group_leader(current) && pspace_leader(current->group_leader)) { + return -EPERM; + } /* * Kill all other threads in the thread group. * We must hold tasklist_lock to call zap_other_threads. -- 1.0.GIT