[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20131116063956.GI26901@order.stressinduktion.org>
Date: Sat, 16 Nov 2013 07:39:56 +0100
From: Hannes Frederic Sowa <hannes@...essinduktion.org>
To: Eric Dumazet <eric.dumazet@...il.com>
Cc: mpb <mpb.mail@...il.com>, netdev@...r.kernel.org
Subject: Re: [PATCH v2] socket: don't return uninitialized addresses on concurrent socket shutdown
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?
--
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