[Bug 245974] fileargs_fopen() does not work properly with fifos
bugzilla-noreply at freebsd.org
bugzilla-noreply at freebsd.org
Mon Apr 27 15:19:41 UTC 2020
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: bugs at FreeBSD.org
Reporter: markj at 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.
More information about the freebsd-bugs
mailing list