https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=245974

            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: b...@freebsd.org
          Reporter: ma...@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 for
the first time, cap_fileargs will attempt to open the file twice: once in order
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

-- 
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
freebsd-bugs@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-bugs
To unsubscribe, send any mail to "freebsd-bugs-unsubscr...@freebsd.org"

Reply via email to