From owner-freebsd-current  Fri Dec  6 20:34: 5 2002
Delivered-To: freebsd-current@freebsd.org
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP
	id 2361B37B401; Fri,  6 Dec 2002 20:34:03 -0800 (PST)
Received: from obsecurity.dyndns.org (adsl-64-169-104-228.dsl.lsan03.pacbell.net [64.169.104.228])
	by mx1.FreeBSD.org (Postfix) with ESMTP
	id EA71143E4A; Fri,  6 Dec 2002 20:33:56 -0800 (PST)
	(envelope-from kris@obsecurity.org)
Received: from rot13.obsecurity.org (rot13.obsecurity.org [10.0.0.5])
	by obsecurity.dyndns.org (Postfix) with ESMTP
	id 6F22A66BE3; Fri,  6 Dec 2002 20:33:56 -0800 (PST)
Received: by rot13.obsecurity.org (Postfix, from userid 1000)
	id EAB411376; Fri,  6 Dec 2002 20:33:55 -0800 (PST)
Date: Fri, 6 Dec 2002 20:33:55 -0800
From: Kris Kennaway <kris@obsecurity.org>
To: Lars Eggert <larse@ISI.EDU>
Cc: Kris Kennaway <kris@obsecurity.org>, current@FreeBSD.ORG,
	jhb@FreeBSD.org, alfred@FreeBSD.org
Subject: Re: LOR: filedesc structure -> pipe mutex
Message-ID: <20021207043355.GA75597@rot13.obsecurity.org>
References: <3DF12681.8020008@isi.edu> <20021207022253.GA69717@rot13.obsecurity.org> <3DF1686B.6040503@isi.edu>
Mime-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha1;
	protocol="application/pgp-signature"; boundary="TB36FDmn/VVEgNH/"
Content-Disposition: inline
In-Reply-To: <3DF1686B.6040503@isi.edu>
User-Agent: Mutt/1.4i
Sender: owner-freebsd-current@FreeBSD.ORG
Precedence: bulk
List-ID: <freebsd-current.FreeBSD.ORG>
List-Archive: <http://docs.freebsd.org/mail/> (Web Archive)
List-Help: <mailto:majordomo@FreeBSD.ORG?subject=help> (List Instructions)
List-Subscribe: <mailto:majordomo@FreeBSD.ORG?subject=subscribe%20freebsd-current>
List-Unsubscribe: <mailto:majordomo@FreeBSD.ORG?subject=unsubscribe%20freebsd-current>
X-Loop: FreeBSD.ORG


--TB36FDmn/VVEgNH/
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

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 },

--TB36FDmn/VVEgNH/
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (FreeBSD)

iD8DBQE98XozWry0BWjoQKURAlHsAKCI6OAGS0iQEZ/WmcK7MIRESsWorwCg/dTo
1j5NBBVAOwL9GfRYfMKGDGg=
=jSlf
-----END PGP SIGNATURE-----

--TB36FDmn/VVEgNH/--

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