Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 8 Jul 2006 08:40:38 +0200 (CEST)
From:      Martin Blapp <mb@imp.ch>
To:        freebsd-current@freebsd.org
Subject:   Re: Please help reviewing ! Got another crash because of the ttymodem() / ttyclose() race
Message-ID:  <20060708081419.W14714@godot.imp.ch>
In-Reply-To: <200607072236.55319.jhb@freebsd.org>
References:  <20060708020700.A14714@godot.imp.ch> <200607072236.55319.jhb@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20060708081419.W14714>