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:	Sat, 16 Nov 2013 16:36:24 -0800
From:	Eric Dumazet <eric.dumazet@...il.com>
To:	Hannes Frederic Sowa <hannes@...essinduktion.org>
Cc:	mpb <mpb.mail@...il.com>, netdev@...r.kernel.org
Subject: Re: [PATCH v3] net: don't return uninitialized addresses on
 concurrent socket shutdown

On Sat, 2013-11-16 at 23:43 +0100, Hannes Frederic Sowa wrote:

> I do think it is common to call recvfrom, process the packet and sendto
> back a packet with the updated values from recvfrom. We accept AF_UNSPEC
> on an IPv4 UDP socket and use the addresses as it would be a AF_INET
> sockaddr. We only bail out if the port is 0.
> 
> It was my intend to at least clear the addressing portions of the regular
> sockaddr_* structure for the user as it could be reused as explained
> earlier and be allocated uninitialized on the stack (or reused, so
> sending packet to a previous destination). I think it is very uncommon to
> expect a non-error value on a recvfrom/recvmsg and have AF_UNSPEC in the
> sockaddr.
> 
> (I erroneously stated that we could return the full 128 zero bytes, we only
> clear 128 bytes and return only max(128, msg.msg_namelen). msg_namelen gets
> updated by the recvmsg handler and that only iff we have this concurrent
> shutdown and blocking read issue.)
> 
> If the socket structure is cleared a following sendto would produce a -EINVAL.
> 
> Maybe I am too sensible regarding such problems and will think about that a
> bit more (and check for AF_INVALID/AF_UNSPEC).
> 


I think the _default_ should be to clear it.

-	msg.msg_namelen = sizeof(address);
+	msg.msg_namelen = 0;

And subsystems filling a real address would set it back to the length
they took care of.

in recvfrom() paths, the kernel _knows_ it uses an array of 128 bytes.
(struct sockaddr_storage)



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