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]
Date:	Thu, 27 Mar 2014 13:29:41 +0000
From:	Rainer Weikusat <rweikusat@...ileactivedefense.com>
To:	David Laight <David.Laight@...LAB.COM>
Cc:	Eric Dumazet <eric.dumazet@...il.com>,
	David Miller <davem@...emloft.net>,
	netdev <netdev@...r.kernel.org>
Subject: Re: [PATCH] net: unix: non blocking recvmsg() should not return -EINTR

David Laight <David.Laight@...LAB.COM> writes:
> From: Rainer Weikusat 
>> Considering all of this, the trylock-approach seems best to me. OTOH,
>
> No - using trylock() is definitely wrong.
> If there are two messages queued and two processes/threads try to
> read them, you don't want one of them being given EAGAIN.

I'd consider this acceptable because a second message could also come in
at the very moment the 2nd reader gives up. This is the 'next simplest
approach' after 'returning EAGAIN instead of EINTR' and I think it is a
little less non-desirable because it avoids the mixed blocking/
non-blocking problem (presently, I don't see why this shouldn't work,
ie, a process which inherited a socket ought to be able to switch that
to non-blocking mode and then call recv without risking to stop
executing for 'a long time'), and it is still reasonably simple (although
the problem is likely rather contrived).

Anything beyond that would involve priorising non-blocking readers over
blocking ones and let them wait uninterruptedly in case the lock is
presently held by another non-blocking reader. But this would be a whole
lot more complicated and even waiting for a blocking reader might work
just fine if a message arrives soon enough. Which then again means "it
should wait some time uninterruptedly in any case" but how much time?

The whole issue would neatly "not exist" if only one process could ever
be executing kernel code at any given time, but since is not the case
anymore, some kind of 'heuristic solution based on a tradeoff' is
necessary.

--
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