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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20170728180611.11249-2-deepa.kernel@gmail.com>
Date:   Fri, 28 Jul 2017 11:06:06 -0700
From:   Deepa Dinamani <deepa.kernel@...il.com>
To:     viro@...iv.linux.org.uk, linux-kernel@...r.kernel.org
Cc:     linux-fsdevel@...r.kernel.org, arnd@...db.de,
        y2038@...ts.linaro.org
Subject: [PATCH 1/6] ipc: Make sys_semtimedop() y2038 safe

struct timespec is not y2038 safe on 32 bit machines.
Replace timespec with y2038 safe struct timespec64.

Note that the patch only changes the internals without
modifying the syscall interface. This will be part
of a separate series.

Signed-off-by: Deepa Dinamani <deepa.kernel@...il.com>
---
 ipc/sem.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/ipc/sem.c b/ipc/sem.c
index 8b3b40c54a58..b41cd00d104c 100644
--- a/ipc/sem.c
+++ b/ipc/sem.c
@@ -1861,7 +1861,7 @@ static struct sem_undo *find_alloc_undo(struct ipc_namespace *ns, int semid)
 }
 
 static long do_semtimedop(int semid, struct sembuf __user *tsops,
-		unsigned nsops, const struct timespec *timeout)
+		unsigned nsops, const struct timespec64 *timeout)
 {
 	int error = -EINVAL;
 	struct sem_array *sma;
@@ -1897,7 +1897,7 @@ static long do_semtimedop(int semid, struct sembuf __user *tsops,
 			error = -EINVAL;
 			goto out_free;
 		}
-		jiffies_left = timespec_to_jiffies(timeout);
+		jiffies_left = timespec64_to_jiffies(timeout);
 	}
 
 	max = 0;
@@ -2116,8 +2116,8 @@ SYSCALL_DEFINE4(semtimedop, int, semid, struct sembuf __user *, tsops,
 		unsigned, nsops, const struct timespec __user *, timeout)
 {
 	if (timeout) {
-		struct timespec ts;
-		if (copy_from_user(&ts, timeout, sizeof(*timeout)))
+		struct timespec64 ts;
+		if (get_timespec64(&ts, timeout))
 			return -EFAULT;
 		return do_semtimedop(semid, tsops, nsops, &ts);
 	}
@@ -2130,8 +2130,8 @@ COMPAT_SYSCALL_DEFINE4(semtimedop, int, semid, struct sembuf __user *, tsems,
 		       const struct compat_timespec __user *, timeout)
 {
 	if (timeout) {
-		struct timespec ts;
-		if (compat_get_timespec(&ts, timeout))
+		struct timespec64 ts;
+		if (compat_get_timespec64(&ts, timeout))
 			return -EFAULT;
 		return do_semtimedop(semid, tsems, nsops, &ts);
 	}
-- 
2.11.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ