From owner-freebsd-stable@FreeBSD.ORG Fri Nov 6 08:57:22 2009 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9A6A8106566B; Fri, 6 Nov 2009 08:57:22 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from mail-bw0-f213.google.com (mail-bw0-f213.google.com [209.85.218.213]) by mx1.freebsd.org (Postfix) with ESMTP id CB66E8FC13; Fri, 6 Nov 2009 08:57:21 +0000 (UTC) Received: by bwz5 with SMTP id 5so924473bwz.3 for ; Fri, 06 Nov 2009 00:57:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:in-reply-to :references:date:x-google-sender-auth:message-id:subject:from:to:cc :content-type; bh=8yGk30zCWtAw5KWeCpJNFfXPDY7F2i5wVxLEhaS6HC0=; b=px/CGiSkEngTqR+yUd9iB/Hn+arFJL4UXw7FgtH9ToTAJpYyJ/rnyd2dk+w10dkrVz u978rjd1sSJFb0Br1NagU7+JO01eZJY/CCRJkezpQrm1dD5sj+FhV5Lutzgb5cQGJGdu 6LS0AyJ+ZYqHun02SYL5B20idbO01S1/fFh80= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; b=uHV565ejv0kWU2BDwKr+/oF/+8XeSsKQlsUPlJFB7l3J4MbMwqeszyflxodFxz5IRc BzhCrGb6hoQvhjLYbZGwVnnMDrclmUOvQQG/nbfssfGrOYJ1La22a4kU52GSvRm5aXES xBzG2G9V2UFwF1BPUqofgJJv/HvPJaVx0JanU= MIME-Version: 1.0 Sender: asmrookie@gmail.com Received: by 10.223.58.208 with SMTP id i16mr588527fah.22.1257497840612; Fri, 06 Nov 2009 00:57:20 -0800 (PST) In-Reply-To: References: Date: Fri, 6 Nov 2009 09:57:20 +0100 X-Google-Sender-Auth: f936111433c45289 Message-ID: <3bbf2fe10911060057t5ebfb330n486c80018826fa93@mail.gmail.com> From: Attilio Rao To: "Dorr H. Clark" Content-Type: text/plain; charset=UTF-8 Cc: freebsd-hackers@freebsd.org, freebsd-bugs@freebsd.org, freebsd-stable@freebsd.org Subject: Re: resource leak in fifo_vnops.c: 6.x/7.x/8.x X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Nov 2009 08:57:22 -0000 2009/11/6 Dorr H. Clark : > > > We believe we have identified a significant resource leak > present in 6.x, 7.x, and 8.x. We believe this is a regression > versus FreeBSD 4.x which appears to do the Right Thing (tm). > > We have a test program (see below) which will run the system > out of sockets by repeated exercise of the failing code > path in the kernel. > > Our proposed fix is applied to the file usr/src/sys/fs/fifofs/fifo_vnops.c > > > @@ -237,6 +237,8 @@ > if (ap->a_mode & FWRITE) { > if ((ap->a_mode & O_NONBLOCK) && fip->fi_readers == 0) { > mtx_unlock(&fifo_mtx); > + /* Exclusive VOP lock is held - safe to clean */ > + fifo_cleanup(vp); > return (ENXIO); > } > fip->fi_writers++; I think it should also check that fip->if_writers == 0 (and possibly the checks within fifo_cleanup() should just be assertions, but that's orthogonal someway) and the comment is not needed. Attilio -- Peace can only be achieved by understanding - A. Einstein