lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <48BC26D9.1040300@shaw.ca>
Date:	Mon, 01 Sep 2008 11:31:05 -0600
From:	Robert Hancock <hancockr@...w.ca>
To:	Michael Noisternig <mnoist@...y.sbg.ac.at>
CC:	linux-kernel@...r.kernel.org
Subject: Re: (more) epoll troubles

Michael Noisternig wrote:
> Hello,
> 
> and sorry again if this is the wrong place to ask (again, please hint to 
> me to an appropriate place to ask in that case).
> 
> After experimenting with epoll edge-triggered mode I am clueless why on 
> a few occassions I seem to not get any input notification despite data 
> is available.
> 
> In detail: I have set up sockets with epoll events 
> EPOLLET|EPOLLRDHUP|EPOLLIN. When I get EPOLLIN for a socket, I read() as 
> long as I get what I asked for, i.e. whenever read() returns either 
> EAGAIN or less data than I asked for I take this as indication that I 
> must wait for another EPOLLIN notification. However, this does not seem 
> to work always.
> 
> Here is some log from my program:
> 
> 0x9e6b8a8: read not avail (1460/2048 read)
> i.e. tried to read 2048 bytes, got 1460 -> assume must wait for EPOLLIN 
> for more data to read
> (note that the fd is always in the epoll set with 
> EPOLLET|EPOLLRDHUP|EPOLLIN)

It would likely be better to always continue trying to read until EAGAIN 
is returned, even if the read returned less than the requested amount, 
as implied here:

http://linux.die.net/man/7/epoll

"The function do_use_fd() uses the new ready file descriptor until 
EAGAIN is returned by either read(2) or write(2). An event driven state 
machine application should, after having received EAGAIN, record its 
current state so that at the next call to do_use_fd() it will continue 
to read(2) or write(2) from where it stopped before. "

> 
> 0x9e6b8a8: read not avail (1460/2048 read)
> got EPOLLIN notification, read 1460 bytes again -> wait for another 
> notification
> 
> ..after a few minutes without any notification...
> 
> 0x9e6b8a8: GOT RDHUP (2001:0/80002001:0)
> i.e. got notification for EPOLLRDHUP|EPOLLIN (2001), was waiting for 
> EPOLLET|EPOLLRDHUP|EPOLLIN (80002001)
> 
> 0x9e6b8a8: read not avail (342/2048 read)
> then on trying to read we find data in the buffer (???)
> 
> 0x9e6b8a8: stored 16384 bytes
> this is the amount of data we expected to get /immediately/, i.e. 
> without a minutes delay and rdhup
> 
> Of course you might think that the other side sent the data only just 
> before closing its side, but it is unlikely since we expected to get the 
> 16384 bytes in one go (this is how that L7 protocol works), and I see 
> this odd behaviour of missing input notifications now and then.
> 
> Does anybody know/have an idea why I am missing EPOLLIN notifications?
> 
> Any help is appreciated!!! Thanks in advance,
> Michael
> (please CC me when replying)
> -- 
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@...r.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ