Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 7 Dec 2002 09:03:42 -0500 (EST)
From:      Robert Watson <rwatson@FreeBSD.ORG>
To:        Kris Kennaway <kris@obsecurity.org>
Cc:        Lars Eggert <larse@ISI.EDU>, current@FreeBSD.ORG, jhb@FreeBSD.ORG, alfred@FreeBSD.ORG
Subject:   Re: LOR: filedesc structure -> pipe mutex
Message-ID:  <Pine.NEB.3.96L.1021207090124.9402I-100000@fledge.watson.org>
In-Reply-To: <20021207043355.GA75597@rot13.obsecurity.org>

next in thread | previous in thread | raw e-mail | index | archive | help
BTW, one upshot of this whole event is that we should probably be
hard-coding the lock order of all important locks rather than allowing it
to be automatically determined.  We'd uncover problems of this sort much
faster and much more easily, and it would provide better documentation of
the intended lock order.  Also, the authors of the following locking bits
should document them in the SMPng architecture document:

- File descriptor locking
- Pipe locking
- Select locking
- Process locking

I've gone ahead and documented the SIGIO locking, and I might get to the
rest sometime also, but it would be a lot faster if the people who did the
work documented it rather than having to rely on a lot of code reading to
figure out the subtleties.

Do we know if WITNESS supports the notion of a partial order, in which it
is simply asserted that there is no valid locking order between two locks? 

Robert N M Watson             FreeBSD Core Team, TrustedBSD Projects
robert@fledge.watson.org      Network Associates Laboratories

On Fri, 6 Dec 2002, Kris Kennaway wrote:

> On Fri, Dec 06, 2002 at 07:18:03PM -0800, Lars Eggert wrote:
> 
> > >I'm getting this too:
> 
> After discussing this with various people on IRC, it was determined
> that this is not the place where the reversal is occurring, but since
> witness doesn't have the lock order defined it has to guess, and in
> this instance it is guessing the wrong way around.  After adding the
> lock order to subr_witness.c I now get this:
> 
> lock order reversal
>  1st 0xc41bc418 process lock (process lock) @ /local0/src-client/sys/kern/kern_descrip.c:2094
>  2nd 0xc42de934 filedesc structure (filedesc structure) @ /local0/src-client/sys/kern/kern_descrip.c:2101
> Debugger("witness_lock")
> Stopped at      Debugger+0x45:  xchgl   %ebx,in_Debugger.0
> db> trace
> Debugger(c037a085) at Debugger+0x45
> witness_lock(c42de934,8,c039e3cc,835,c41bc418) at witness_lock+0x532
> _mtx_lock_flags(c42de934,0,c039e3cc,835,0) at _mtx_lock_flags+0x7f
> sysctl_kern_file(c03d8a00,0,0,d7aaac08) at sysctl_kern_file+0x119
> sysctl_root(0,d7aaacb4,2,d7aaac08,c0416240) at sysctl_root+0x116
> userland_sysctl(c3f84a80,d7aaacb4,2,bfbfe588,bfbff3f8) at userland_sysctl+0xec
> __sysctl(c3f84a80,d7aaad14,6,1,297) at __sysctl+0x71
> syscall(2f,2f,2f,2,bfbfe588) at syscall+0x211
> Xint0x80_syscall() at Xint0x80_syscall+0x1d
> --- syscall (202, FreeBSD ELF32, __sysctl), eip = 0x805a717, esp = 0xbfbfe53c, ebp = 0xbfbfe568 ---
> db>
> 
> Index: sys/kern/subr_witness.c
> ===================================================================
> RCS file: /home/ncvs/src/sys/kern/subr_witness.c,v
> retrieving revision 1.130
> diff -u -r1.130 subr_witness.c
> --- sys/kern/subr_witness.c     11 Nov 2002 16:36:20 -0000      1.130
> +++ sys/kern/subr_witness.c     7 Dec 2002 04:18:29 -0000
> @@ -198,6 +198,8 @@
> 	{ "Giant", &lock_class_mtx_sleep },
> 	{ "proctree", &lock_class_sx },
> 	{ "allproc", &lock_class_sx },
> +	{ "filedesc structure", &lock_class_mtx_sleep },
> +	{ "pipe mutex", &lock_class_mtx_sleep },
> 	{ "sigio lock", &lock_class_mtx_sleep },
> 	{ "process group", &lock_class_mtx_sleep },
> 	{ "process lock", &lock_class_mtx_sleep },
> 


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.NEB.3.96L.1021207090124.9402I-100000>