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-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87ha6l83l1.fsf@sable.mobileactivedefense.com>
Date:	Wed, 26 Mar 2014 13:57:46 +0000
From:	Rainer Weikusat <rweikusat@...ileactivedefense.com>
To:	Eric Dumazet <eric.dumazet@...il.com>
Cc:	David Miller <davem@...emloft.net>, netdev <netdev@...r.kernel.org>
Subject: Re: [PATCH] net: unix: non blocking recvmsg() should not return -EINTR

Rainer Weikusat <rw@...le> writes:
> Eric Dumazet <eric.dumazet@...il.com> writes:
>> From: Eric Dumazet <edumazet@...gle.com>
>>
>> Some applications didn't expect recvmsg() on a non blocking socket
>> could return -EINTR. This possibility was added as a side effect
>> of commit b3ca9b02b00704 ("net: fix multithreaded signal handling in
>> unix recv routines").
>>
>> To hit this bug, you need to be a bit unlucky, as the u->readlock
>> mutex is usually held for very small periods.

[...]

> the function was interrupted before any data was available and it
> is unknown if the condition supposed to be signalled by EAGAIN had
> otherwise occurred.

Further explanation of the difference:

do
	rc = recv(...);
while (rc == -1 && errno == EINTR);

is 'usually sensible code' while

do
	rc = recv(...);
while (rc == -1 && errno == EAGAIN);

usually isn't: One is a one-off event not expected to occur again
'soon', the other implies that "do something else for a while" would be
advisable. In particular, EAGAIN usually shouldn't happen after 'data is
available now' was signalled by select/ poll/ $you_name_it and while it
would be prudent to handle it nevertheless (especially considering that
Linux doesn't necessarily behave in this way), there are doubtlessly
applications 'unprepared' for that, too.


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ