Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 27 Apr 2020 15:19:41 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 245974] fileargs_fopen() does not work properly with fifos
Message-ID:  <bug-245974-227@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D245974

            Bug ID: 245974
           Summary: fileargs_fopen() does not work properly with fifos
           Product: Base System
           Version: CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: bin
          Assignee: bugs@FreeBSD.org
          Reporter: markj@FreeBSD.org

The fileargs service maintains a cache of open fds, presumably so that
fileargs_open() does not have to make multiple round-trips if the sandboxed
program opens the same file multiple times.  However, when opening a file f=
or
the first time, cap_fileargs will attempt to open the file twice: once in o=
rder
to respond to the open request, and a second time when adding the file to a
"cache" nvlist.  If we are opening a fifo for reading this can cause the
service to unexpectedly block twice:

reader: opens fifo and blocks
writer: opens fifo, writes some data, closes the fifo
reader: opens the fifo a second time, blocks again

I suspect we should just avoid reopening the file, though I don't quite
understand the whole caching mechanism yet.

This can be demonstrated using tail -f:

$ mkfifo /tmp/test.fifo
$ tail -f /tmp/test.fifo

from another shell

$ echo a > /tmp/test.fifo

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-245974-227>