Bug 224615 - [PATCH] kevent: EVFILT_READ returns EV_EOF on named pipe when it should not
Summary: [PATCH] kevent: EVFILT_READ returns EV_EOF on named pipe when it should not
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-bugs mailing list
URL:
Keywords: patch
Depends on:
Blocks:
 
Reported: 2017-12-27 14:16 UTC by Jan Kokemüller
Modified: 2019-02-12 22:30 UTC (History)
2 users (show)

See Also:


Attachments
patch for filt_piperead (894 bytes, patch)
2017-12-27 14:16 UTC, Jan Kokemüller
no flags Details | Diff
patch to pipepoll.c demonstrating the issue (1.21 KB, patch)
2017-12-27 14:16 UTC, Jan Kokemüller
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Kokemüller 2017-12-27 14:16:13 UTC
Created attachment 189130 [details]
patch for filt_piperead

When connecting as a new reader to a named pipe after all previous writers have disconnected, EVFILT_READ currently returns EV_EOF.

poll(2) was fixed a while ago so that it won't return POLLHUP in this case (at least since r238936). The attached patch brings the logic in EVFILT_READ in sync with poll(2) again.

I wonder why the other side of the pipe is also checked in EVFILT_READ. Wouldn't it be enough to just check for EOF on the readers side? This would be consistent with sockets for example (where just SBS_CANTRCVMORE leads to EV_EOF).

I've also attached a small patch to the pipepoll.c regression test that can be used to reproduce the issue.
Comment 1 Jan Kokemüller 2017-12-27 14:16:53 UTC
Created attachment 189131 [details]
patch to pipepoll.c demonstrating the issue