Re: Please help reviewing ! Got another crash because of the ttymodem() / ttyclose() race

From: Martin Blapp <mb_at_imp.ch>
Date: Sat, 8 Jul 2006 08:40:38 +0200 (CEST)
Hi,

> Yes..  did you see my reply on the mailing list

Ouch ? No I missed that ! Thanks. I just read it.

> I'm not sure that the proctree_lock should protect t_pgrp as that is part
> of the tty structure, not process groups or session structures.

Hmm ? In /usr/src/sys/kern/tty.c:1215 we copy in ttioctl() the pointers of 
p->p_session and p->p_pgrp to the tty structure.

1215                tp->t_session = p->p_session;
1216                tp->t_pgrp = p->p_pgrp;
1217                SESS_LOCK(p->p_session);

It looks to me that we have to protect it with the locks of the
process groups or session structures since its only a copy of the pointer,
and not an exact copy. Else I wouldn't had any crashes - this is the mess.
Or do I understand something completly wrong ?

>I think probably it should be protected by Giant for now until the tty subsystem
>is locked.  Also, the ttyinfo() part will not work since it tries to
>acquire a mutex (PGRP_LOCK()) while holding a spin mutex (sched_lock).

Ok, fixed. Does it look better now ?

Btw. this version is now running for three days without any crashes on four 
SMP boxes. Rocking stable so far.

>perhaps instead we need to expand Giant to cover it until the tty subsystem is 
>locked?

How would you do that ?

Martin
Received on Sat Jul 08 2006 - 04:40:43 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:58 UTC