From owner-freebsd-net@FreeBSD.ORG Thu Nov 2 11:33:11 2006 Return-Path: X-Original-To: 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 ADA3016A415 for ; Thu, 2 Nov 2006 11:33:11 +0000 (UTC) (envelope-from max@love2party.net) Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.187]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0261B43D5F for ; Thu, 2 Nov 2006 11:33:06 +0000 (GMT) (envelope-from max@love2party.net) Received: from [88.64.180.200] (helo=amd64.laiers.local) by mrelayeu.kundenserver.de (node=mrelayeu1) with ESMTP (Nemesis), id 0MKwpI-1GfaoQ43WO-0000hc; Thu, 02 Nov 2006 12:32:49 +0100 From: Max Laier Organization: FreeBSD To: freebsd-net@freebsd.org Date: Thu, 2 Nov 2006 12:32:40 +0100 User-Agent: KMail/1.9.4 References: <20061102102807.GA23553@zen.inc> <4549C93A.9080308@delphij.net> In-Reply-To: <4549C93A.9080308@delphij.net> X-Face: ,,8R(x[kmU]tKN@>gtH1yQE4aslGdu+2]; R]*pL,U>^H?)gW@49@wdJ`H<=?utf-8?q?=25=7D*=5FBD=0A=09U=5For=3D=5CmOZf764=26nYj=3DJYbR1PW0ud?=>|!~,,CPC.1-D$FG@0h3#'5"k{V]a~.<=?utf-8?q?mZ=7D44=23Se=7Em=0A=09Fe=7E=5C=5DX5B=5D=5Fxj?=(ykz9QKMw_l0C2AQ]}Ym8)fU MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart2053230.SOOuEtbO6C"; protocol="application/pgp-signature"; micalg=pgp-sha1 Content-Transfer-Encoding: 7bit Message-Id: <200611021232.45858.max@love2party.net> X-Provags-ID: kundenserver.de abuse@kundenserver.de login:61c499deaeeba3ba5be80f48ecc83056 Cc: VANHULLEBUS Yvan , LI Xin Subject: Re: Reentrant problem with inet_ntoa in the kernel X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Nov 2006 11:33:11 -0000 --nextPart2053230.SOOuEtbO6C Content-Type: text/plain; charset="iso-8859-6" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On Thursday 02 November 2006 11:32, LI Xin wrote: > VANHULLEBUS Yvan wrote: > > On Thu, Nov 02, 2006 at 06:19:43PM +0800, LI Xin wrote: > > [.....] > > > >> Sounds like a workaround to me and in theory that is insufficient > >> for a MPSAFE protection. Here is a patch which reduces the chance > >> where we get a race. > > > > Hi. > > > > This patch will allow multiple calls to inet_ntoa int the same > > function (like printf(....., inet_ntoa(a), inet_ntoa(b))), but won't > > really solve the race condition if inet_ntoa is called from 2 > > differents functions at the same time: at least the round should be > > locked to reduce potential problems, and you're still not sure that > > no more than 8 "simultaneous" (or at least close enough) calls will > > be done. > > True. That's exactly what I concern about, it just reduced the chance > we lose a race, not to eliminate it. > > Note that the code is similar with what was found in ip6_sprintf, so it > got same issue I think. Just what I was trying to say in my initial, cut-off reply. The question=20 we have to answer is, how much do we care about logging / console printfs=20 of IP numbers. AFAIK, console printf isn't (?wasn't?) synchronized=20 properly, either. In the end the caller has to decide how much it cares=20 about the result. Security related logging facilities should certainly=20 use a private buffer (or better yet, do the conversion in userland). All=20 I'm argueing is, that we should be aware of the sideeffects (substantial=20 grow in stack size) of the suggested patch and weight it carefully=20 against the benefit (100% correctness in the unlikeliest of cases). I=20 think that we can live with a 8 slot ring buffer for most of the cases. =20 =46ixing the race on the round counter seems essential, however. =2D-=20 /"\ Best regards, | mlaier@freebsd.org \ / Max Laier | ICQ #67774661 X http://pf4freebsd.love2party.net/ | mlaier@EFnet / \ ASCII Ribbon Campaign | Against HTML Mail and News --nextPart2053230.SOOuEtbO6C Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (FreeBSD) iD8DBQBFSdddXyyEoT62BG0RAgqTAJ9nGS0dSdfDWUGw0YIGD8TBRc+lwwCfcAzs i6S1TaWKFyw/gCuK5Vc1zx4= =9ev3 -----END PGP SIGNATURE----- --nextPart2053230.SOOuEtbO6C--