From owner-freebsd-net@FreeBSD.ORG Thu Mar 25 03:12:39 2004 Return-Path: <owner-freebsd-net@FreeBSD.ORG> Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id ED18316A4CE; Thu, 25 Mar 2004 03:12:39 -0800 (PST) Received: from darkness.comp.waw.pl (unknown [195.117.238.236]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8C13B43D46; Thu, 25 Mar 2004 03:12:39 -0800 (PST) (envelope-from pjd@darkness.comp.waw.pl) Received: by darkness.comp.waw.pl (Postfix, from userid 1009) id 8925CACAF8; Thu, 25 Mar 2004 12:12:35 +0100 (CET) Date: Thu, 25 Mar 2004 12:12:35 +0100 From: Pawel Jakub Dawidek <pjd@FreeBSD.org> To: Robert Watson <rwatson@FreeBSD.org> Message-ID: <20040325111235.GY8930@darkness.comp.waw.pl> References: <20040323123831.GM8930@darkness.comp.waw.pl> <Pine.NEB.3.96L.1040323181412.20483A-100000@fledge.watson.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="xsFQtFdnkC8cTCzR" Content-Disposition: inline In-Reply-To: <Pine.NEB.3.96L.1040323181412.20483A-100000@fledge.watson.org> User-Agent: Mutt/1.4.2i X-PGP-Key-URL: http://people.freebsd.org/~pjd/pjd.asc X-OS: FreeBSD 5.2.1-RC2 i386 cc: freebsd-net@FreeBSD.org Subject: Re: in_pcbbind_setup(), etc. X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Networking and TCP/IP with FreeBSD <freebsd-net.freebsd.org> List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-net>, <mailto:freebsd-net-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/freebsd-net> List-Post: <mailto:freebsd-net@freebsd.org> List-Help: <mailto:freebsd-net-request@freebsd.org?subject=help> List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-net>, <mailto:freebsd-net-request@freebsd.org?subject=subscribe> X-List-Received-Date: Thu, 25 Mar 2004 11:12:40 -0000 --xsFQtFdnkC8cTCzR Content-Type: text/plain; charset=iso-8859-2 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Mar 23, 2004 at 06:16:31PM -0500, Robert Watson wrote: +> > For example: 'td' can be NULL? It is offten tested, but not always, +> > Line 290: +> > if (sin->sin_addr.s_addr !=3D INADDR_ANY) +> > if (prison_ip(td->td_ucred, 0, &sin->sin_addr.s_addr)) +> > return(EINVAL); +> > td_ucred is used, but 'td' is not tested. +> >=20 +> > If this is always current thread, it can't be NULL, right? If this not +> > have to be current thread, we cannot touch td_ucred here, because (from +> > proc.h):=20 +>=20 +> Prior to FreeBSD 5.x, curproc could be NULL in interrupt context. With +> the introduction of curthread and the move to interrupt threads, curthre= ad +> became always non-NULL. However, sometimes the use of curthread may not +> make sense. :-) I think I'd prefer it if we passed an explicit +> credential into a number of these situations, which could be NULL if "the +> system" was requesting a service as opposed to an explicit user process. +> However, I'm not 100% convinced that is the right approach either. Note +> that we have some similar "confusions" relating to use of cached +> credentials in sockets, etc. The whole issue probably needs to be +> discussed after some detailed analysis, and revisited. Ok, I've add few line at start of in_pcbbind_setup(): if (td =3D=3D NULL) printf("NULL td in %s\n", __func__); if (td !=3D curthread) printf("td !=3D curthread in %s\n", __func__); And I'm seeing 2nd printf() while mounting NFS file systems. If so, I think using td->td_ucred in this function isn't safe... --=20 Pawel Jakub Dawidek http://www.FreeBSD.org pjd@FreeBSD.org http://garage.freebsd.pl FreeBSD committer Am I Evil? Yes, I Am! --xsFQtFdnkC8cTCzR Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (FreeBSD) iD8DBQFAYr6jForvXbEpPzQRAr47AJ0bBy3kVhkKFBcHy+vwn30O5/icpwCgnoW8 /Cn/X6spWO9oNt/UxLW95wM= =t1Rj -----END PGP SIGNATURE----- --xsFQtFdnkC8cTCzR--