From owner-svn-src-head@FreeBSD.ORG Wed Jun 20 21:41:56 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9CD6A1065673; Wed, 20 Jun 2012 21:41:56 +0000 (UTC) (envelope-from delphij@delphij.net) Received: from anubis.delphij.net (anubis.delphij.net [64.62.153.212]) by mx1.freebsd.org (Postfix) with ESMTP id 7AC8A8FC0C; Wed, 20 Jun 2012 21:41:56 +0000 (UTC) Received: from delta.delphij.net (drawbridge.ixsystems.com [206.40.55.65]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by anubis.delphij.net (Postfix) with ESMTPSA id 43E185AAF; Wed, 20 Jun 2012 14:41:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=delphij.net; s=anubis; t=1340228516; bh=XyU5PPr7jtVyqYdKpLbR9vJClbVqVCjpgLtzMB1bq5o=; h=Date:From:Reply-To:To:CC:Subject:References:In-Reply-To; b=zx102Ixt8DxQ4pvamheeOgUlwnlRbG+MVewALq5FAN6acjt85fNJk8jP5BDGLTGy6 BWTb6c5AnKDQw+TnWjQGoc+QV6eyaYoEfQyilMGR5r2hQ/l3lQlsXfPujfgleKolKC UZkZwyWHWBl8ldZ0KpfcET816CZBwiGWQp2CFLVs= Message-ID: <4FE243A3.1070202@delphij.net> Date: Wed, 20 Jun 2012 14:41:55 -0700 From: Xin Li Organization: The FreeBSD Project MIME-Version: 1.0 To: Colin Percival References: <201206200638.q5K6cg7u024024@svn.freebsd.org> <20120621015220.J2636@besplex.bde.org> <4FE1FC23.9000904@freebsd.org> <690DF487-F7CB-421E-B6BC-F7CE6BC0F658@bsdimp.com> <4FE23F54.5060409@freebsd.org> In-Reply-To: <4FE23F54.5060409@freebsd.org> X-Enigmail-Version: 1.4 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: src-committers@freebsd.org, Eitan Adler , svn-src-all@freebsd.org, Warner Losh , Bruce Evans , svn-src-head@freebsd.org, d@delphij.net Subject: Re: svn commit: r237286 - head/lib/libc/gen X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: d@delphij.net List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jun 2012 21:41:56 -0000 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 On 06/20/12 14:23, Colin Percival wrote: > On 06/20/12 14:15, Warner Losh wrote: >> On Jun 20, 2012, at 10:36 AM, Colin Percival wrote: >>> On 06/20/12 09:27, Bruce Evans wrote: >>>> On Wed, 20 Jun 2012, Eitan Adler wrote: >>>>> Log: Don't close an uninitialized descriptor. [1] Add a >>>>> sanity check for the validity of the passed fd. >>>> >>>> Library functions shouldn't use assert() or abort(). >>> >>> Why not? >> >> We've tried to avoid things that make the library dump core... > > You mean, we avoid it except in the places where we don't? It > seems to me that dumping core is exactly the right way to handle a > "can't ever happen" situation inside libc -- just like the ~250 > instances of assert() in jemalloc. > > If you mean "passing an invalid parameter to a library function > shouldn't result in a core dump", I agree -- but that's not the > case here. But malloc() is a rare place that we typically consider as "low level" enough where, no better remedies are provided from API prospective -- there is nothing better than crashing the program immediately, since that would likely to lead us to where the smoking gun is. Library procedures normally detect and report errors, but don't handle them like this. Also, as Bruce pointed out, it's a case that can never happen and thus the explicit assert is just a waste of space. Cheers, - -- Xin LI https://www.delphij.net/ FreeBSD - The Power to Serve! Live free or die -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iQEcBAEBCAAGBQJP4kOjAAoJEG80Jeu8UPuzs/cH/ixT9Emrdb4MDoVA3WCE9TS6 W3DE0SbvFtRLrtsSI8i8EsET87sRtOiIoEjFUuRa7HYO3JL3hr9wzLLa84k2sCEW pSPa0pKJ3ZhQR7O3UMb3PxAQxwG4uoFhxST6MuAOci2ySojwbK0YAg5G+TyBf1ch V2MNG2ZIg3tGAmT96/YHONYmP3rleHNDSoYQ5N3m9Svu8am1qRrg8Tz+Z+M0c1db SpJvWBsmrk60xpcZUlHMlO6L1TB5eCAE+pxTiN41xDlL8sXwHIzWf+g7YUyzRa+n 82fpnDPnm6VfdnPHug3MBQ/gRdIMw2aApqEtwRmRTQHIz41t5MA1b48qAWrTH3o= =V4AY -----END PGP SIGNATURE-----