Bug 14985 - EPOLL_NONBLOCK definition erroneous
Summary: EPOLL_NONBLOCK definition erroneous
Status: RESOLVED FIXED
Alias: None
Product: glibc
Classification: Unclassified
Component: libc (show other bugs)
Version: unspecified
: P2 minor
Target Milestone: 2.18
Assignee: Andreas Jaeger
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-12-28 01:42 UTC by Rich Felker
Modified: 2014-06-14 05:28 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:
fweimer: security-


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Rich Felker 2012-12-28 01:42:56 UTC
glibc's sys/epoll.h defines EPOLL_NONBLOCK for use with epoll_create1; however, the kernel's epoll_create1 function contains the following code:

        if (flags & ~EPOLL_CLOEXEC)
                return -EINVAL;

Moreover, the kernel's eventpoll.h header does not define EPOLL_NONBLOCK at all. EPOLL_NONBLOCK seems to be a glibc invention that disagrees with the reality of the kernel and which might confuse developers attempting to use this interface.

I believe a little more research should be done into why it was added to begin with, and, unless there's a good reason for its existence, it should be removed. If this flag is really intended by the glibc developers to exist, it should be emulated in userspace by glibc using fcntl since the kernel obviously does not accept it.
Comment 1 Andreas Jaeger 2013-01-08 18:35:20 UTC
Thanks, fixed for glibc 2.18 with this commit:

commit c40ea3d9a3be8645441967cddf14645b84af5f2c
Author: Andreas Jaeger <aj@suse.de>
Date:   Tue Jan 8 19:32:00 2013 +0100

    BZ#14985: Remove erroneous EPOLL_NONBLOCK