patch-2.3.23 linux/kernel/exit.c
Next file: linux/kernel/fork.c
Previous file: linux/ipc/shm.c
Back to the patch index
Back to the overall index
- Lines: 62
- Date:
Mon Oct 18 11:35:32 1999
- Orig file:
v2.3.22/linux/kernel/exit.c
- Orig date:
Thu Aug 26 13:05:42 1999
diff -u --recursive --new-file v2.3.22/linux/kernel/exit.c linux/kernel/exit.c
@@ -135,7 +135,9 @@
read_lock(&tasklist_lock);
for_each_task(p) {
if (p->p_opptr == father) {
+ /* We dont want people slaying init */
p->exit_signal = SIGCHLD;
+ p->self_exec_id++;
p->p_opptr = child_reaper; /* init */
if (p->pdeath_signal) send_sig(p->pdeath_signal, p, 0);
}
@@ -288,7 +290,7 @@
*/
static void exit_notify(void)
{
- struct task_struct * p;
+ struct task_struct * p, *t;
forget_original_parent(current);
/*
@@ -300,15 +302,39 @@
* and we were the only connection outside, so our pgrp
* is about to become orphaned.
*/
- if ((current->p_pptr->pgrp != current->pgrp) &&
- (current->p_pptr->session == current->session) &&
+
+ t = current->p_pptr;
+
+ if ((t->pgrp != current->pgrp) &&
+ (t->session == current->session) &&
will_become_orphaned_pgrp(current->pgrp, current) &&
has_stopped_jobs(current->pgrp)) {
kill_pg(current->pgrp,SIGHUP,1);
kill_pg(current->pgrp,SIGCONT,1);
}
- /* Let father know we died */
+ /* Let father know we died
+ *
+ * Thread signals are configurable, but you aren't going to use
+ * that to send signals to arbitary processes.
+ * That stops right now.
+ *
+ * If the parent exec id doesn't match the exec id we saved
+ * when we started then we know the parent has changed security
+ * domain.
+ *
+ * If our self_exec id doesn't match our parent_exec_id then
+ * we have changed execution domain as these two values started
+ * the same after a fork.
+ *
+ */
+
+ if(current->exit_signal != SIGCHLD &&
+ ( current->parent_exec_id != t->self_exec_id ||
+ current->self_exec_id != current->parent_exec_id)
+ && !capable(CAP_KILL))
+ current->exit_signal = SIGCHLD;
+
notify_parent(current, current->exit_signal);
/*
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)