Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 8 Feb 2003 14:04:56 -0800
From:      Kris Kennaway <kris@obsecurity.org>
To:        Thomas Moestl <tmoestl@gmx.net>
Cc:        Morten Rodal <morten@rodal.no>, Kris Kennaway <kris@obsecurity.org>, current@FreeBSD.ORG
Subject:   Re: Panic in fork()
Message-ID:  <20030208220456.GB15257@rot13.obsecurity.org>
In-Reply-To: <20030208151226.GB624@crow.dom2ip.de>
References:  <20030208092406.GA12104@rot13.obsecurity.org> <20030208110512.GB12696@rot13.obsecurity.org> <20030208141542.GC11725@slurp.rodal.no> <20030208151226.GB624@crow.dom2ip.de>

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

--jq0ap7NbKX2Kqbes
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Sat, Feb 08, 2003 at 04:12:26PM +0100, Thomas Moestl wrote:

> addr2line will usually point to the first line of a statement if it
> spans multiple lines; in this case, the full guard is:
>=20
> 			while (p2->p_pid =3D=3D trypid ||
> 			    p2->p_pgrp->pg_id =3D=3D trypid ||
> 			    p2->p_session->s_sid =3D=3D trypid) {

OK, I suspected that.

tjr was looking into this last night and proposed the following patch:

http://people.freebsd.org/~tjr/kf.diff

Kris

Index: kern_fork.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /x/freebsd/src/sys/kern/kern_fork.c,v
retrieving revision 1.181
diff -u -r1.181 kern_fork.c
--- kern_fork.c	1 Feb 2003 12:17:07 -0000	1.181
+++ kern_fork.c	8 Feb 2003 11:32:18 -0000
@@ -318,6 +318,7 @@
 	 * exceed the limit. The variable nprocs is the current number of
 	 * processes, maxproc is the limit.
 	 */
+	sx_slock(&proctree_lock);
 	sx_xlock(&allproc_lock);
 	uid =3D td->td_ucred->cr_ruid;
 	if ((nprocs >=3D maxproc - 10 && uid !=3D 0) || nprocs >=3D maxproc) {
@@ -425,6 +426,7 @@
 	LIST_INSERT_HEAD(&allproc, p2, p_list);
 	LIST_INSERT_HEAD(PIDHASH(p2->p_pid), p2, p_hash);
 	sx_xunlock(&allproc_lock);
+	sx_sunlock(&proctree_lock);
=20
 	/*
 	 * Malloc things while we don't hold any locks.
@@ -759,6 +761,7 @@
 	return (0);
 fail:
 	sx_xunlock(&allproc_lock);
+	sx_sunlock(&proctree_lock);
 	uma_zfree(proc_zone, newproc);
 	if (p1->p_flag & P_KSES) {
 		PROC_LOCK(p1);

--jq0ap7NbKX2Kqbes
Content-Type: application/pgp-signature
Content-Disposition: inline

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

iD8DBQE+RX8IWry0BWjoQKURAgiCAKCxL7rUGCNP/duXmwjHNUXUGzn4HQCdERUS
oAHnk4QKRGxPzVV5Fc0QZP8=
=sET8
-----END PGP SIGNATURE-----

--jq0ap7NbKX2Kqbes--

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?20030208220456.GB15257>