From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/193 Path: news.gmane.org!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: some fixes to musl Date: Fri, 22 Jul 2011 09:30:21 -0400 Message-ID: <20110722133021.GF132@brightrain.aerifal.cx> References: <20110721170255.GA7352@albatros> <20110721182101.GB132@brightrain.aerifal.cx> <20110721190031.GA3682@openwall.com> <20110722081910.GA3593@albatros> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1311342059 15760 80.91.229.12 (22 Jul 2011 13:40:59 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 22 Jul 2011 13:40:59 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-277-gllmg-musl=m.gmane.org@lists.openwall.com Fri Jul 22 15:40:55 2011 Return-path: Envelope-to: gllmg-musl@lo.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by lo.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1QkFyJ-0004Sq-EQ for gllmg-musl@lo.gmane.org; Fri, 22 Jul 2011 15:40:55 +0200 Original-Received: (qmail 11325 invoked by uid 550); 22 Jul 2011 13:40:54 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 11317 invoked from network); 22 Jul 2011 13:40:54 -0000 Content-Disposition: inline In-Reply-To: <20110722081910.GA3593@albatros> User-Agent: Mutt/1.5.21 (2010-09-15) Xref: news.gmane.org gmane.linux.lib.musl.general:193 Archived-At: On Fri, Jul 22, 2011 at 12:19:10PM +0400, Vasiliy Kulikov wrote: > On Thu, Jul 21, 2011 at 23:00 +0400, Solar Designer wrote: > > Personally, I've been using different approaches to this in different > > ones of my programs. For musl, I think the "always check" approach may > > be the better one. Yes, the code size increase from those error > > handling paths is unfortunate... Some use of goto can make them smaller > > and keep them out of the same cache lines with actually running code. > > The problem here is that there might be no good way to handle errors > of error handling code. If we allocate resource A, then B, and B > allocation fails, we should release A and return error code. What to do > if releasing A fails? Return error code and leave A allocated > (==leaked)? Try to release it in a cycle (potential infinite loop)? > Terminate the process (not expected by the caller)? > > I don't have a good solution... The good solution is to demand that kernel developers not create such bugs and calling them out on it when they do... Rich