vsock: Enable y2038 safe timeval for timeout
Reuse the timeval compat code from core/sock to handle 32-bit and
64-bit timeval structures. Also introduce a new socket option define
to allow using y2038 safe timeval under 32-bit.
The existing behavior of sock_set_timeout and vsock's timeout setter
differ when the time value is out of bounds. vsocks current behavior
is retained at the expense of not being able to share the full
implementation.
This allows the LTP test vsock01 to pass under 32-bit compat mode.
Fixes: fe0c72f3db ("socket: move compat timeout handling into sock.c")
Signed-off-by: Richard Palethorpe <rpalethorpe@suse.com>
Cc: Richard Palethorpe <rpalethorpe@richiejp.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
685c3f2fba
commit
4c1e34c0db
4 changed files with 55 additions and 22 deletions
|
|
@ -64,7 +64,7 @@
|
|||
* timeout for a STREAM socket.
|
||||
*/
|
||||
|
||||
#define SO_VM_SOCKETS_CONNECT_TIMEOUT 6
|
||||
#define SO_VM_SOCKETS_CONNECT_TIMEOUT_OLD 6
|
||||
|
||||
/* Option name for using non-blocking send/receive. Use as the option name
|
||||
* for setsockopt(3) or getsockopt(3) to set or get the non-blocking
|
||||
|
|
@ -81,6 +81,17 @@
|
|||
|
||||
#define SO_VM_SOCKETS_NONBLOCK_TXRX 7
|
||||
|
||||
#define SO_VM_SOCKETS_CONNECT_TIMEOUT_NEW 8
|
||||
|
||||
#if !defined(__KERNEL__)
|
||||
#if __BITS_PER_LONG == 64 || (defined(__x86_64__) && defined(__ILP32__))
|
||||
#define SO_VM_SOCKETS_CONNECT_TIMEOUT SO_VM_SOCKETS_CONNECT_TIMEOUT_OLD
|
||||
#else
|
||||
#define SO_VM_SOCKETS_CONNECT_TIMEOUT \
|
||||
(sizeof(time_t) == sizeof(__kernel_long_t) ? SO_VM_SOCKETS_CONNECT_TIMEOUT_OLD : SO_VM_SOCKETS_CONNECT_TIMEOUT_NEW)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* The vSocket equivalent of INADDR_ANY. This works for the svm_cid field of
|
||||
* sockaddr_vm and indicates the context ID of the current endpoint.
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue