From owner-freebsd-bugs@FreeBSD.ORG Tue Sep 13 11:23:39 2005 Return-Path: X-Original-To: bugs@FreeBSD.org Delivered-To: freebsd-bugs@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 58EB416A41F for ; Tue, 13 Sep 2005 11:23:39 +0000 (GMT) (envelope-from robert@fledge.watson.org) Received: from cyrus.watson.org (cyrus.watson.org [204.156.12.53]) by mx1.FreeBSD.org (Postfix) with ESMTP id B681943D45 for ; Tue, 13 Sep 2005 11:23:38 +0000 (GMT) (envelope-from robert@fledge.watson.org) Received: from fledge.watson.org (fledge.watson.org [204.156.12.50]) by cyrus.watson.org (Postfix) with ESMTP id 13D2146B06 for ; Tue, 13 Sep 2005 07:23:38 -0400 (EDT) X-Return-Path: X-Received: from cyrus.watson.org ([unix socket]) by cyrus.watson.org (Cyrus v2.1.17) with LMTP; Tue, 13 Sep 2005 07:21:58 -0400 X-Sieve: CMU Sieve 2.2 X-Received: from mx2.freebsd.org (mx2.freebsd.org [216.136.204.119]) by cyrus.watson.org (Postfix) with ESMTP id 5F8DE46BDA for ; Tue, 13 Sep 2005 07:21:58 -0400 (EDT) X-Received: from hub.freebsd.org (hub.freebsd.org [216.136.204.18]) by mx2.freebsd.org (Postfix) with ESMTP id 05B0A5550C for ; Tue, 13 Sep 2005 11:21:57 +0000 (GMT) (envelope-from rwatson@FreeBSD.org) X-Received: by hub.freebsd.org (Postfix) id ED28A16A421; Tue, 13 Sep 2005 11:21:57 +0000 (GMT) X-Delivered-To: rwatson@hub.freebsd.org X-Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id EA84D16A420 for ; Tue, 13 Sep 2005 11:21:57 +0000 (GMT) (envelope-from rwatson@FreeBSD.org) X-Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id B75FB43D45; Tue, 13 Sep 2005 11:21:57 +0000 (GMT) (envelope-from rwatson@FreeBSD.org) X-Received: from freefall.freebsd.org (rwatson@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.3/8.13.3) with ESMTP id j8DBLvi8016665; Tue, 13 Sep 2005 11:21:57 GMT (envelope-from rwatson@freefall.freebsd.org) X-Received: (from rwatson@localhost) by freefall.freebsd.org (8.13.3/8.13.1/Submit) id j8DBLvpe016661; Tue, 13 Sep 2005 11:21:57 GMT (envelope-from rwatson) Date: Tue, 13 Sep 2005 11:21:57 GMT From: Robert Watson Message-Id: <200509131121.j8DBLvpe016661@freefall.freebsd.org> To: dlt@mebtel.net, rwatson@FreeBSD.org, rwatson@FreeBSD.org ReSent-Date: Tue, 13 Sep 2005 12:23:35 +0100 (BST) Resent-From: robert Resent-To: bugs@FreeBSD.org ReSent-Subject: Re: kern/74242: Write to fifo with no reader fails in 6.0 current ReSent-Message-ID: <20050913122335.G23515@fledge.watson.org> Cc: Subject: Re: kern/74242: Write to fifo with no reader fails in 6.0 current X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Sep 2005 11:23:39 -0000 Synopsis: Write to fifo with no reader fails in 6.0 current State-Changed-From-To: open->feedback State-Changed-By: rwatson State-Changed-When: Tue Sep 13 11:10:48 GMT 2005 State-Changed-Why: When I run the "tick" and "speak" programs as described, I get EBADF back from the read() call in "tick", as open() has failed, which results from mknod() failing with EPERM. This somewhat obscure failure mode was due to a lack of error checking in the test programs, which didn't confirm that the fifo had been created or opened before attempting I/O on the returned descriptor. If run sequentially, "tick" actually does work, since "speak" calls mkfifo(), which succeeds. When the mknod() call in "tick" is replaced with mkfifo(), the tests appear to operate correctly on recent 7.x. When I ran the test programs as provided on 4.x, they failed, but worked with the mkfifo change. There appears to be some disagreement about whether mknod(S_FIFO) should work for unprivileged users. FreeBSD 4.x does not permit this. FreeBSD 6.x and 7.x do not permit this. It could well be that FreeBSD 5.x does permit this. POSIX indicates that privilege is required for non-S_FIFO, but appears to allow mknod(2) as an acceptable interface to create fifos as an unprivileged user. It could be that we should broaden the scope of mknod(2) to require privilege only for non-fifo objects, in order to provide more portable support for fifos. Could you confirm that, in your environment, the source of the read() error is in fact that mknod() has failed (detected by checking for a return value of -1, and then printed using err(-1, "mknod")), and that if the fifo is created using mkfifo(), "tick" operates properly in your environment? This would help us identify that there isn't another bug lurking here. FYI, it could be that FreeBSD 5.3 appeared to allow this by virtue of the fact that the order in which the provided programs are run is quite significant in how they operate: later runs of "tick" will work fine as the fifo has been created by a prior run of "speak", and then not been removed. Thanks, Robert Watson http://www.freebsd.org/cgi/query-pr.cgi?pr=74242