All of lore.kernel.org
 help / color / mirror / Atom feed
From: Deepa Dinamani <deepa.kernel@gmail.com>
To: davem@davemloft.net, linux-kernel@vger.kernel.org
Cc: netdev@vger.kernel.org, arnd@arndb.de, y2038@lists.linaro.org
Subject: [PATCH 1/3] socket: Use old_timeval types for socket timeouts
Date: Mon,  7 Jan 2019 21:22:53 -0800	[thread overview]
Message-ID: <20190108052255.10699-2-deepa.kernel@gmail.com> (raw)
In-Reply-To: <20190108052255.10699-1-deepa.kernel@gmail.com>

As part of y2038 solution, all internal uses of
struct timeval are replaced by struct __kernel_old_timeval
and struct compat_timeval by struct old_timeval32.
Make socket timeouts use these new types.

This is mainly to be able to verify that the kernel build
is y2038 safe when such non y2038 safe types are not
supported anymore.

Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com>
---
 net/compat.c             | 10 +++++-----
 net/core/sock.c          |  8 ++++----
 net/vmw_vsock/af_vsock.c |  4 ++--
 3 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/net/compat.c b/net/compat.c
index b6ff0899e424..cbc15f65033c 100644
--- a/net/compat.c
+++ b/net/compat.c
@@ -351,8 +351,8 @@ static int do_set_attach_filter(struct socket *sock, int level, int optname,
 static int do_set_sock_timeout(struct socket *sock, int level,
 		int optname, char __user *optval, unsigned int optlen)
 {
-	struct compat_timeval __user *up = (struct compat_timeval __user *)optval;
-	struct timeval ktime;
+	struct old_timeval32 __user *up = (struct old_timeval32 __user *)optval;
+	struct __kernel_old_timeval ktime;
 	mm_segment_t old_fs;
 	int err;
 
@@ -420,12 +420,12 @@ COMPAT_SYSCALL_DEFINE5(setsockopt, int, fd, int, level, int, optname,
 static int do_get_sock_timeout(struct socket *sock, int level, int optname,
 		char __user *optval, int __user *optlen)
 {
-	struct compat_timeval __user *up;
-	struct timeval ktime;
+	struct old_timeval32 __user *up;
+	struct __kernel_old_timeval ktime;
 	mm_segment_t old_fs;
 	int len, err;
 
-	up = (struct compat_timeval __user *)optval;
+	up = (struct old_timeval32 __user *)optval;
 	if (get_user(len, optlen))
 		return -EFAULT;
 	if (len < sizeof(*up))
diff --git a/net/core/sock.c b/net/core/sock.c
index 78df5228ffbd..af0fb33624e2 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -337,7 +337,7 @@ EXPORT_SYMBOL(__sk_backlog_rcv);
 
 static int sock_set_timeout(long *timeo_p, char __user *optval, int optlen)
 {
-	struct timeval tv;
+	struct __kernel_old_timeval tv;
 
 	if (optlen < sizeof(tv))
 		return -EINVAL;
@@ -1113,7 +1113,7 @@ int sock_getsockopt(struct socket *sock, int level, int optname,
 		int val;
 		u64 val64;
 		struct linger ling;
-		struct timeval tm;
+		struct __kernel_old_timeval tm;
 		struct sock_txtime txtime;
 	} v;
 
@@ -1223,7 +1223,7 @@ int sock_getsockopt(struct socket *sock, int level, int optname,
 		break;
 
 	case SO_RCVTIMEO:
-		lv = sizeof(struct timeval);
+		lv = sizeof(struct __kernel_old_timeval);
 		if (sk->sk_rcvtimeo == MAX_SCHEDULE_TIMEOUT) {
 			v.tm.tv_sec = 0;
 			v.tm.tv_usec = 0;
@@ -1234,7 +1234,7 @@ int sock_getsockopt(struct socket *sock, int level, int optname,
 		break;
 
 	case SO_SNDTIMEO:
-		lv = sizeof(struct timeval);
+		lv = sizeof(struct __kernel_old_timeval);
 		if (sk->sk_sndtimeo == MAX_SCHEDULE_TIMEOUT) {
 			v.tm.tv_sec = 0;
 			v.tm.tv_usec = 0;
diff --git a/net/vmw_vsock/af_vsock.c b/net/vmw_vsock/af_vsock.c
index 43a1dec08825..e1149bf1b57b 100644
--- a/net/vmw_vsock/af_vsock.c
+++ b/net/vmw_vsock/af_vsock.c
@@ -1439,7 +1439,7 @@ static int vsock_stream_setsockopt(struct socket *sock,
 		break;
 
 	case SO_VM_SOCKETS_CONNECT_TIMEOUT: {
-		struct timeval tv;
+		struct __kernel_old_timeval tv;
 		COPY_IN(tv);
 		if (tv.tv_sec >= 0 && tv.tv_usec < USEC_PER_SEC &&
 		    tv.tv_sec < (MAX_SCHEDULE_TIMEOUT / HZ - 1)) {
@@ -1517,7 +1517,7 @@ static int vsock_stream_getsockopt(struct socket *sock,
 		break;
 
 	case SO_VM_SOCKETS_CONNECT_TIMEOUT: {
-		struct timeval tv;
+		struct __kernel_old_timeval tv;
 		tv.tv_sec = vsk->connect_timeout / HZ;
 		tv.tv_usec =
 		    (vsk->connect_timeout -
-- 
2.17.1


  reply	other threads:[~2019-01-08  5:23 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-08  5:22 [PATCH 0/3] net: y2038-safe socket timeout options Deepa Dinamani
2019-01-08  5:22 ` [Cluster-devel] " Deepa Dinamani
2019-01-08  5:22 ` Deepa Dinamani
2019-01-08  5:22 ` Deepa Dinamani
2019-01-08  5:22 ` Deepa Dinamani [this message]
2019-01-08  5:22 ` [PATCH 2/3] socket: Rename SO_RCVTIMEO/ SO_SNDTIMEO with _OLD suffixes Deepa Dinamani
2019-01-08  5:22   ` [Cluster-devel] " Deepa Dinamani
2019-01-08  5:22   ` Deepa Dinamani
2019-01-08  5:22   ` Deepa Dinamani
2019-01-08 20:03   ` Arnd Bergmann
2019-01-08 20:03     ` [Cluster-devel] " Arnd Bergmann
2019-01-08 20:03     ` Arnd Bergmann
2019-01-08 20:03     ` Arnd Bergmann
2019-01-08 20:09     ` [PATCH] socket: move compat timeout handling into sock.c Arnd Bergmann
2019-01-08 20:09       ` [Cluster-devel] " Arnd Bergmann
2019-01-08 20:09       ` Arnd Bergmann
2019-01-08 20:09       ` Arnd Bergmann
2019-01-08 20:09       ` Arnd Bergmann
2019-01-08 21:29       ` Deepa Dinamani
2019-01-08 21:29         ` [Cluster-devel] " Deepa Dinamani
2019-01-08 21:29         ` Deepa Dinamani
2019-01-08 21:29         ` Deepa Dinamani
2019-01-08 21:19     ` [PATCH 2/3] socket: Rename SO_RCVTIMEO/ SO_SNDTIMEO with _OLD suffixes Deepa Dinamani
2019-01-08 21:19       ` [Cluster-devel] " Deepa Dinamani
2019-01-08 21:19       ` Deepa Dinamani
2019-01-08 21:19       ` Deepa Dinamani
2019-01-08  5:22 ` [PATCH 3/3] sock: Add SO_RCVTIMEO_NEW and SO_SNDTIMEO_NEW Deepa Dinamani
2019-01-08  5:22   ` [Cluster-devel] " Deepa Dinamani
2019-01-08  5:22   ` Deepa Dinamani
2019-01-08  5:22   ` Deepa Dinamani

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190108052255.10699-2-deepa.kernel@gmail.com \
    --to=deepa.kernel@gmail.com \
    --cc=arnd@arndb.de \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=y2038@lists.linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.