From: Alan Cox Subject: Re: [PATCH] nextfd(2) Date: Thu, 12 Apr 2012 12:11:24 +0100 Message-ID: <20120412121124.64aee2f6@pyramind.ukuu.org.uk> References: <20120401125741.GA7484@p183.telecom.by> <4F78D0BA.9040709@zytor.com> <4F7F1659.5090305@zytor.com> <20120406201601.GA3310@p183.telecom.by> <4F7F59E1.2040009@zytor.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: "H. Peter Anvin" , akpm@linux-foundation.org, viro@zeniv.linux.org.uk, torvalds@linux-foundation.org, drepper@gmail.com, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org To: Alexey Dobriyan Return-path: Received: from lxorguk.ukuu.org.uk ([81.2.110.251]:58248 "EHLO lxorguk.ukuu.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757419Ab2DLLIw convert rfc822-to-8bit (ORCPT ); Thu, 12 Apr 2012 07:08:52 -0400 In-Reply-To: Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Thu, 12 Apr 2012 13:54:25 +0300 Alexey Dobriyan wrote: > On Sat, Apr 7, 2012 at 12:02 AM, H. Peter Anvin wrote= : > > On 04/06/2012 01:16 PM, Alexey Dobriyan wrote: > >> > >> closefrom(3) written via nextfd(2) loop is reliable and doesn't fa= il. > >> closefrom(3) written via /proc/self/fd is reliable and can fail (i= ncluding ENOMEM). > >> closefrom(3) written via close(fd++) is unreliable. > >> > > > > I call shenanigans on this. =A0There is no reason to ENOMEM on the = second > > written using the fdwalk() implementation I already posted, for exa= mple. >=20 > open("/proc/self/fd") can fail with ENOMEM. Any syscall can fail with a process kill due to a stack extend on out o= f memory in most configurations. That includes your nextfd stuff This whole thing is getting stupid. "Perfection is the enemy of success". Your code will also fail when the cat pees on the computer, when the power fails and when disk dies. I suspect that other than the cat these are all more likely real world cases than your ENOMEM. Alan -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel= " in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html