Re: [PATCH net-next v5 11/12] socket: Rename SO_RCVTIMEO/ SO_SNDTIMEO with _OLD suffixes

From: Michael Ellerman
Date: Wed Feb 06 2019 - 06:58:24 EST


Deepa Dinamani <deepa.kernel@xxxxxxxxx> writes:

> SO_RCVTIMEO and SO_SNDTIMEO socket options use struct timeval
> as the time format. struct timeval is not y2038 safe.
> The subsequent patches in the series add support for new socket
> timeout options with _NEW suffix that will use y2038 safe
> data structures. Although the existing struct timeval layout
> is sufficiently wide to represent timeouts, because of the way
> libc will interpret time_t based on user defined flag, these
> new flags provide a way of having a structure that is the same
> for all architectures consistently.
> Rename the existing options with _OLD suffix forms so that the
> right option is enabled for userspace applications according
> to the architecture and time_t definition of libc.
>
> Signed-off-by: Deepa Dinamani <deepa.kernel@xxxxxxxxx>
> Acked-by: Willem de Bruijn <willemb@xxxxxxxxxx>
> Cc: ccaulfie@xxxxxxxxxx
> Cc: deller@xxxxxx
> Cc: paulus@xxxxxxxxx
> Cc: ralf@xxxxxxxxxxxxxx
> Cc: rth@xxxxxxxxxxx
> Cc: cluster-devel@xxxxxxxxxx
> Cc: linuxppc-dev@xxxxxxxxxxxxxxxx
> Cc: linux-alpha@xxxxxxxxxxxxxxx
> Cc: linux-arch@xxxxxxxxxxxxxxx
> Cc: linux-mips@xxxxxxxxxxxxxxx
> Cc: linux-parisc@xxxxxxxxxxxxxxx
> Cc: sparclinux@xxxxxxxxxxxxxxx
> ---
> arch/alpha/include/uapi/asm/socket.h | 7 +++++--
> arch/mips/include/uapi/asm/socket.h | 6 ++++--
> arch/parisc/include/uapi/asm/socket.h | 6 ++++--
> arch/powerpc/include/uapi/asm/socket.h | 4 ++--

The powerpc changes look OK to me.

Acked-by: Michael Ellerman <mpe@xxxxxxxxxxxxxx> (powerpc)

cheers

> diff --git a/arch/powerpc/include/uapi/asm/socket.h b/arch/powerpc/include/uapi/asm/socket.h
> index 94de465e0920..12aa0c43e775 100644
> --- a/arch/powerpc/include/uapi/asm/socket.h
> +++ b/arch/powerpc/include/uapi/asm/socket.h
> @@ -11,8 +11,8 @@
>
> #define SO_RCVLOWAT 16
> #define SO_SNDLOWAT 17
> -#define SO_RCVTIMEO 18
> -#define SO_SNDTIMEO 19
> +#define SO_RCVTIMEO_OLD 18
> +#define SO_SNDTIMEO_OLD 19
> #define SO_PASSCRED 20
> #define SO_PEERCRED 21
>
> diff --git a/include/uapi/asm-generic/socket.h b/include/uapi/asm-generic/socket.h
> index 2713e0fa68ef..c56b8b487c12 100644
> --- a/include/uapi/asm-generic/socket.h
> +++ b/include/uapi/asm-generic/socket.h
> @@ -30,8 +30,8 @@
> #define SO_PEERCRED 17
> #define SO_RCVLOWAT 18
> #define SO_SNDLOWAT 19
> -#define SO_RCVTIMEO 20
> -#define SO_SNDTIMEO 21
> +#define SO_RCVTIMEO_OLD 20
> +#define SO_SNDTIMEO_OLD 21
> #endif
>
> /* Security levels - as per NRL IPv6 - don't actually do anything */
> @@ -116,6 +116,8 @@
>
> #if !defined(__KERNEL__)
>
> +#define SO_RCVTIMEO SO_RCVTIMEO_OLD
> +#define SO_SNDTIMEO SO_SNDTIMEO_OLD
> #if __BITS_PER_LONG == 64 || (defined(__x86_64__) && defined(__ILP32__))
> /* on 64-bit and x32, avoid the ?: operator */
> #define SO_TIMESTAMP SO_TIMESTAMP_OLD