net: Fix recvmmsg timeout handling

As reported by Elie de Brauwer the timeout handling in the recvmmsg
syscall had issues that boil down to it not properly passing the
remaining time to each underlying recvmsg() call.

Fix it by adding a timeout pointer to the recvmsg implementations, so
that it can use that in a variation of sock_rcvtimeo() that overrides
the value in SO_RCVTIMEO with the timeout passed and returns the
remaining time in that pointer, this way each underlying recvmsg call
receives the remaining time.

It ends up in most cases being just a forward of this pointer from the
per protocol recvmsg() implementations to skb_recv_datagram().

Reported-by: Elie De Brauwer <eliedebrauwer@gmail.com>
Reported-by: Michael Kerrisk <mtk.manpages@gmail.com>
Tested-by: Michael Kerrisk <mtk.manpages@gmail.com>
Cc: Caitlin Bestler <caitlin.bestler@gmail.com>
Cc: Chris Friesen <chris.friesen@windriver.com>
Cc: Elie De Brauwer <eliedebrauwer@gmail.com>
Cc: Michael Kerrisk <mtk.manpages@gmail.com>
Cc: Neil Horman <nhorman@tuxdriver.com>
Cc: Ondřej Bílka <neleai@seznam.cz>
Cc: Paul Moore <paul@paul-moore.com>
Cc: Rémi Denis-Courmont <remi@remlab.net>
Cc: Steven Whitehouse <steve@chygwyn.com>
Link: http://lkml.kernel.org/n/net-next-c99v9e01bp1galgfvp4bagu5@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
73 files changed