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: <20131116064200.GJ26901@order.stressinduktion.org>
Date:	Sat, 16 Nov 2013 07:42:00 +0100
From:	Hannes Frederic Sowa <hannes@...essinduktion.org>
To:	Eric Dumazet <eric.dumazet@...il.com>, mpb <mpb.mail@...il.com>,
	netdev@...r.kernel.org
Subject: Re: [PATCH v2] socket: don't return uninitialized addresses on concurrent socket shutdown

On Sat, Nov 16, 2013 at 07:39:56AM +0100, Hannes Frederic Sowa wrote:
> On Fri, Nov 15, 2013 at 10:32:49PM -0800, Eric Dumazet wrote:
> > On Sat, 2013-11-16 at 06:48 +0100, Hannes Frederic Sowa wrote:
> > > If a blocking read waits on a socket which gets concurrently shut down we
> > > return 0 as error and so indicate success to the socket functions which
> > > thus copy an uninitialized stack allocated address back to the user.
> > > Fix this by clearing the 128 byte size (on x86-64) address first.
> > > 
> > > This patch fixes the problem for recvfrom, recvmsg and recvmmsg.
> > > 
> > > Reported-by: mpb <mpb.mail@...il.com>
> > > Signed-off-by: Hannes Frederic Sowa <hannes@...essinduktion.org>
> > > ---
> > 
> > Are you clearing 128 bytes on every recvfrom() system call, just in case
> > of this shutdown() issue ?
> 
> Yes, that gave me a bad feeling, too (so I explicitly mentioned it in the
> changelog and hoped for some discussion).
> 
> > Can't we avoid this overhead ?
> > 
> > msg.msg_namelen should be set to 0 in this case.
> 
> I don't see how, currently. Either we tunnel a new return value through
> ->recvmsg or we use the address structure, mark it with a special AF_FOO and
> check if we get back that same value.
> 
> I don't see how msg.msg_namelen set to zero can help?

We could also think about changing the return value on concurrent closed
sockets entirely and avoiding this whole issue. It would only change
concurrent shutdown()/read() behaviour, not close as far as I can see.

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