From owner-cvs-src@FreeBSD.ORG Fri Jun 6 12:18:33 2008 Return-Path: Delivered-To: cvs-src@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 425911065677; Fri, 6 Jun 2008 12:18:33 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 27AFE8FC2C; Fri, 6 Jun 2008 12:18:33 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.1/8.14.1) with ESMTP id m56CIXkb013761; Fri, 6 Jun 2008 12:18:33 GMT (envelope-from kib@repoman.freebsd.org) Received: (from svn2cvs@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id m56CIXJX013760; Fri, 6 Jun 2008 12:18:33 GMT (envelope-from kib@repoman.freebsd.org) Message-Id: <200806061218.m56CIXJX013760@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: svn2cvs set sender to kib@repoman.freebsd.org using -f From: Konstantin Belousov Date: Fri, 6 Jun 2008 12:17:28 +0000 (UTC) To: src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org X-FreeBSD-CVS-Branch: RELENG_7 Cc: Subject: cvs commit: src/sys/kern sys_pipe.c src/sys/sys pipe.h X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Jun 2008 12:18:33 -0000 kib 2008-06-06 12:17:28 UTC FreeBSD src repository Modified files: (Branch: RELENG_7) sys/kern sys_pipe.c sys/sys pipe.h Log: SVN rev 179616 on 2008-06-06 12:17:28Z by kib MFC rev. 1.198 of sys/kern/sys_pipe.c, rev. 1.30 of sys/sys/pipe.h AKA r179243. Another problem caused by the knlist_cleardel() potentially dropping PIPE_MTX(). Since the pipe_present is cleared before (potentially) sleeping, the second thread may enter the pipeclose() for the reciprocal pipe end. The test at the end of the pipeclose() for the pipe_present == 0 would succeed, allowing the second thread to free the pipe memory. First threads then accesses the freed memory after being woken up. Properly track the closing state of the pipe in the pipe_present. Introduce the intermediate state that marks the pipe as mostly dismantled but might be sleeping waiting for the knote list to be cleared. Free the pipe pair memory only when both ends pass that point. Revision Changes Path 1.191.2.3 +22 -11 src/sys/kern/sys_pipe.c 1.29.10.1 +7 -0 src/sys/sys/pipe.h