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@gmail.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

authored by

Deepa Dinamani and committed by
Al Viro
3ef56dc2 8ac72a46

+6 -6
+6 -6
ipc/sem.c
··· 1856 } 1857 1858 static long do_semtimedop(int semid, struct sembuf __user *tsops, 1859 - unsigned nsops, const struct timespec *timeout) 1860 { 1861 int error = -EINVAL; 1862 struct sem_array *sma; ··· 1892 error = -EINVAL; 1893 goto out_free; 1894 } 1895 - jiffies_left = timespec_to_jiffies(timeout); 1896 } 1897 1898 max = 0; ··· 2111 unsigned, nsops, const struct timespec __user *, timeout) 2112 { 2113 if (timeout) { 2114 - struct timespec ts; 2115 - if (copy_from_user(&ts, timeout, sizeof(*timeout))) 2116 return -EFAULT; 2117 return do_semtimedop(semid, tsops, nsops, &ts); 2118 } ··· 2125 const struct compat_timespec __user *, timeout) 2126 { 2127 if (timeout) { 2128 - struct timespec ts; 2129 - if (compat_get_timespec(&ts, timeout)) 2130 return -EFAULT; 2131 return do_semtimedop(semid, tsems, nsops, &ts); 2132 }
··· 1856 } 1857 1858 static long do_semtimedop(int semid, struct sembuf __user *tsops, 1859 + unsigned nsops, const struct timespec64 *timeout) 1860 { 1861 int error = -EINVAL; 1862 struct sem_array *sma; ··· 1892 error = -EINVAL; 1893 goto out_free; 1894 } 1895 + jiffies_left = timespec64_to_jiffies(timeout); 1896 } 1897 1898 max = 0; ··· 2111 unsigned, nsops, const struct timespec __user *, timeout) 2112 { 2113 if (timeout) { 2114 + struct timespec64 ts; 2115 + if (get_timespec64(&ts, timeout)) 2116 return -EFAULT; 2117 return do_semtimedop(semid, tsops, nsops, &ts); 2118 } ··· 2125 const struct compat_timespec __user *, timeout) 2126 { 2127 if (timeout) { 2128 + struct timespec64 ts; 2129 + if (compat_get_timespec64(&ts, timeout)) 2130 return -EFAULT; 2131 return do_semtimedop(semid, tsems, nsops, &ts); 2132 }