Re: heavy handed exit() in latest BK

Ingo Molnar (mingo@elte.hu)
Sun, 9 Feb 2003 12:40:32 +0100 (CET)


Roland,

there are two bugs in the signal code still:

- a read_lock(&tasklist_lock) is missing around the group_send_sig_info()
in send_sig_info().

- session-IDs and group-IDs are set outside the tasklist lock. This
causes breakage in the USB code. The correct fix is to do this:

void __set_special_pids(pid_t session, pid_t pgrp)
{
struct task_struct *curr = current;

if (curr->session != session) {
detach_pid(curr, PIDTYPE_SID);
curr->session = session;
attach_pid(curr, PIDTYPE_SID, session);
}
if (curr->pgrp != pgrp) {
detach_pid(curr, PIDTYPE_PGID);
curr->pgrp = pgrp;
attach_pid(curr, PIDTYPE_PGID, pgrp);
}
}

void set_special_pids(pid_t session, pid_t pgrp)
{
write_lock_irq(&tasklist_lock);
__set_special_pids(session, pgrp);
write_unlock_irq(&tasklist_lock);
}

and then update all places that do:

- current->session = 1;
- current->pgrp = 1;

to:

+ set_special_pids(1, 1);

otherwise we change the PIDs without properly rehashing them.

Ingo

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/