linux: work around epoll bug in kernels 3.10-3.19

Work around a bug in kernels 3.10 to 3.19 where passing a struct that
has the EPOLLWAKEUP flag set generates spurious syslog audit warnings.

A bad check makes the kernel read the events field when it should not
and complain when the process lacks the CAP_BLOCK_SUSPEND capability.

PR-URL: https://github.com/libuv/libuv/pull/245
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
This commit is contained in:
Ben Noordhuis 2015-03-05 16:47:34 +01:00
parent 073323baca
commit 5645b2d69f

View File

@ -130,8 +130,13 @@ void uv__platform_invalidate_fd(uv_loop_t* loop, int fd) {
*
* We pass in a dummy epoll_event, to work around a bug in old kernels.
*/
if (loop->backend_fd >= 0)
if (loop->backend_fd >= 0) {
/* Work around a bug in kernels 3.10 to 3.19 where passing a struct that
* has the EPOLLWAKEUP flag set generates spurious audit syslog warnings.
*/
memset(&dummy, 0, sizeof(dummy));
uv__epoll_ctl(loop->backend_fd, UV__EPOLL_CTL_DEL, fd, &dummy);
}
}