Linux epoll EPOLL_CTL_ADD op handler should always check registration
of both EVFILT_READ and EVFILT_WRITE kevents to deceide if supplied
file descriptor fd is already registered with epoll instance.
Details
Details
- Reviewers
dchagin emaste - Group Reviewers
Linux Emulation - Commits
- rS355066: Linux epoll: Check both read and write kqueue events existence in EPOLL_CTL_ADD
/* Sample testcase */ #include <sys/epoll.h> #include <assert.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> int main (int argc, char *argv[]) { struct epoll_event event; int epfd, err; epfd = epoll_create1(EPOLL_CLOEXEC); assert(epfd); event.events = EPOLLIN; err = epoll_ctl(epfd, EPOLL_CTL_ADD, STDIN_FILENO, &event); assert(err == 0); event.events = EPOLLOUT; if (epoll_ctl(epfd, EPOLL_CTL_ADD, STDIN_FILENO, &event) == 0) { printf("EPOLL_CTL_ADD (erroneously) succeed\n"); exit(EXIT_FAILURE); } printf("ok\n"); return (EXIT_SUCCESS); }
Diff Detail
Diff Detail
- Repository
- rS FreeBSD src repository - subversion
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
Comment Actions
Do you think we could add all of these test cases to the tree somewhere? (Not integrated w/ ATF presumably as we wouldn't have a convenient way to build Linux binaries.)
Comment Actions
Good idea. I think we can add other permissive licensed epoll unit tests like https://github.com/jiixyj/epoll-shim/blob/master/test/epoll-test.c and https://github.com/cloudius-systems/osv/blob/master/tests/tst-epoll.cc . I will try to take a look at that.
(Not integrated w/ ATF presumably as we wouldn't have a convenient way to build Linux binaries.)
We can store precompiled i386 or amd64 binaries in VCS like we do with firmware blobs