summaryrefslogtreecommitdiffstats
path: root/ipc
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2018-07-13 06:52:28 -0400
committerArnd Bergmann <arnd@arndb.de>2018-08-27 08:48:48 -0400
commit9afc5eee65ca7d717a99d6fe8f4adfe32a40940a (patch)
tree4e5585234e71076c0a5a470b157e0b9de96b8da6 /ipc
parent33e26418193f58d1895f2f968e1953b1caf8deb7 (diff)
y2038: globally rename compat_time to old_time32
Christoph Hellwig suggested a slightly different path for handling backwards compatibility with the 32-bit time_t based system calls: Rather than simply reusing the compat_sys_* entry points on 32-bit architectures unchanged, we get rid of those entry points and the compat_time types by renaming them to something that makes more sense on 32-bit architectures (which don't have a compat mode otherwise), and then share the entry points under the new name with the 64-bit architectures that use them for implementing the compatibility. The following types and interfaces are renamed here, and moved from linux/compat_time.h to linux/time32.h: old new --- --- compat_time_t old_time32_t struct compat_timeval struct old_timeval32 struct compat_timespec struct old_timespec32 struct compat_itimerspec struct old_itimerspec32 ns_to_compat_timeval() ns_to_old_timeval32() get_compat_itimerspec64() get_old_itimerspec32() put_compat_itimerspec64() put_old_itimerspec32() compat_get_timespec64() get_old_timespec32() compat_put_timespec64() put_old_timespec32() As we already have aliases in place, this patch addresses only the instances that are relevant to the system call interface in particular, not those that occur in device drivers and other modules. Those will get handled separately, while providing the 64-bit version of the respective interfaces. I'm not renaming the timex, rusage and itimerval structures, as we are still debating what the new interface will look like, and whether we will need a replacement at all. This also doesn't change the names of the syscall entry points, which can be done more easily when we actually switch over the 32-bit architectures to use them, at that point we need to change COMPAT_SYSCALL_DEFINEx to SYSCALL_DEFINEx with a new name, e.g. with a _time32 suffix. Suggested-by: Christoph Hellwig <hch@infradead.org> Link: https://lore.kernel.org/lkml/20180705222110.GA5698@infradead.org/ Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Diffstat (limited to 'ipc')
-rw-r--r--ipc/mqueue.c8
-rw-r--r--ipc/msg.c6
-rw-r--r--ipc/sem.c10
-rw-r--r--ipc/shm.c6
-rw-r--r--ipc/syscall.c2
-rw-r--r--ipc/util.h2
6 files changed, 17 insertions, 17 deletions
diff --git a/ipc/mqueue.c b/ipc/mqueue.c
index c0d58f390c3b..db7833370351 100644
--- a/ipc/mqueue.c
+++ b/ipc/mqueue.c
@@ -1461,10 +1461,10 @@ COMPAT_SYSCALL_DEFINE3(mq_getsetattr, mqd_t, mqdes,
1461#endif 1461#endif
1462 1462
1463#ifdef CONFIG_COMPAT_32BIT_TIME 1463#ifdef CONFIG_COMPAT_32BIT_TIME
1464static int compat_prepare_timeout(const struct compat_timespec __user *p, 1464static int compat_prepare_timeout(const struct old_timespec32 __user *p,
1465 struct timespec64 *ts) 1465 struct timespec64 *ts)
1466{ 1466{
1467 if (compat_get_timespec64(ts, p)) 1467 if (get_old_timespec32(ts, p))
1468 return -EFAULT; 1468 return -EFAULT;
1469 if (!timespec64_valid(ts)) 1469 if (!timespec64_valid(ts))
1470 return -EINVAL; 1470 return -EINVAL;
@@ -1474,7 +1474,7 @@ static int compat_prepare_timeout(const struct compat_timespec __user *p,
1474COMPAT_SYSCALL_DEFINE5(mq_timedsend, mqd_t, mqdes, 1474COMPAT_SYSCALL_DEFINE5(mq_timedsend, mqd_t, mqdes,
1475 const char __user *, u_msg_ptr, 1475 const char __user *, u_msg_ptr,
1476 compat_size_t, msg_len, unsigned int, msg_prio, 1476 compat_size_t, msg_len, unsigned int, msg_prio,
1477 const struct compat_timespec __user *, u_abs_timeout) 1477 const struct old_timespec32 __user *, u_abs_timeout)
1478{ 1478{
1479 struct timespec64 ts, *p = NULL; 1479 struct timespec64 ts, *p = NULL;
1480 if (u_abs_timeout) { 1480 if (u_abs_timeout) {
@@ -1489,7 +1489,7 @@ COMPAT_SYSCALL_DEFINE5(mq_timedsend, mqd_t, mqdes,
1489COMPAT_SYSCALL_DEFINE5(mq_timedreceive, mqd_t, mqdes, 1489COMPAT_SYSCALL_DEFINE5(mq_timedreceive, mqd_t, mqdes,
1490 char __user *, u_msg_ptr, 1490 char __user *, u_msg_ptr,
1491 compat_size_t, msg_len, unsigned int __user *, u_msg_prio, 1491 compat_size_t, msg_len, unsigned int __user *, u_msg_prio,
1492 const struct compat_timespec __user *, u_abs_timeout) 1492 const struct old_timespec32 __user *, u_abs_timeout)
1493{ 1493{
1494 struct timespec64 ts, *p = NULL; 1494 struct timespec64 ts, *p = NULL;
1495 if (u_abs_timeout) { 1495 if (u_abs_timeout) {
diff --git a/ipc/msg.c b/ipc/msg.c
index 883642cf2b27..0833c6405915 100644
--- a/ipc/msg.c
+++ b/ipc/msg.c
@@ -622,9 +622,9 @@ struct compat_msqid_ds {
622 struct compat_ipc_perm msg_perm; 622 struct compat_ipc_perm msg_perm;
623 compat_uptr_t msg_first; 623 compat_uptr_t msg_first;
624 compat_uptr_t msg_last; 624 compat_uptr_t msg_last;
625 compat_time_t msg_stime; 625 old_time32_t msg_stime;
626 compat_time_t msg_rtime; 626 old_time32_t msg_rtime;
627 compat_time_t msg_ctime; 627 old_time32_t msg_ctime;
628 compat_ulong_t msg_lcbytes; 628 compat_ulong_t msg_lcbytes;
629 compat_ulong_t msg_lqbytes; 629 compat_ulong_t msg_lqbytes;
630 unsigned short msg_cbytes; 630 unsigned short msg_cbytes;
diff --git a/ipc/sem.c b/ipc/sem.c
index 26f8e37fcdcb..745dc6187e84 100644
--- a/ipc/sem.c
+++ b/ipc/sem.c
@@ -1698,8 +1698,8 @@ SYSCALL_DEFINE4(semctl, int, semid, int, semnum, int, cmd, unsigned long, arg)
1698 1698
1699struct compat_semid_ds { 1699struct compat_semid_ds {
1700 struct compat_ipc_perm sem_perm; 1700 struct compat_ipc_perm sem_perm;
1701 compat_time_t sem_otime; 1701 old_time32_t sem_otime;
1702 compat_time_t sem_ctime; 1702 old_time32_t sem_ctime;
1703 compat_uptr_t sem_base; 1703 compat_uptr_t sem_base;
1704 compat_uptr_t sem_pending; 1704 compat_uptr_t sem_pending;
1705 compat_uptr_t sem_pending_last; 1705 compat_uptr_t sem_pending_last;
@@ -2214,11 +2214,11 @@ SYSCALL_DEFINE4(semtimedop, int, semid, struct sembuf __user *, tsops,
2214#ifdef CONFIG_COMPAT_32BIT_TIME 2214#ifdef CONFIG_COMPAT_32BIT_TIME
2215long compat_ksys_semtimedop(int semid, struct sembuf __user *tsems, 2215long compat_ksys_semtimedop(int semid, struct sembuf __user *tsems,
2216 unsigned int nsops, 2216 unsigned int nsops,
2217 const struct compat_timespec __user *timeout) 2217 const struct old_timespec32 __user *timeout)
2218{ 2218{
2219 if (timeout) { 2219 if (timeout) {
2220 struct timespec64 ts; 2220 struct timespec64 ts;
2221 if (compat_get_timespec64(&ts, timeout)) 2221 if (get_old_timespec32(&ts, timeout))
2222 return -EFAULT; 2222 return -EFAULT;
2223 return do_semtimedop(semid, tsems, nsops, &ts); 2223 return do_semtimedop(semid, tsems, nsops, &ts);
2224 } 2224 }
@@ -2227,7 +2227,7 @@ long compat_ksys_semtimedop(int semid, struct sembuf __user *tsems,
2227 2227
2228COMPAT_SYSCALL_DEFINE4(semtimedop, int, semid, struct sembuf __user *, tsems, 2228COMPAT_SYSCALL_DEFINE4(semtimedop, int, semid, struct sembuf __user *, tsems,
2229 unsigned int, nsops, 2229 unsigned int, nsops,
2230 const struct compat_timespec __user *, timeout) 2230 const struct old_timespec32 __user *, timeout)
2231{ 2231{
2232 return compat_ksys_semtimedop(semid, tsems, nsops, timeout); 2232 return compat_ksys_semtimedop(semid, tsems, nsops, timeout);
2233} 2233}
diff --git a/ipc/shm.c b/ipc/shm.c
index b0eb3757ab89..2657692199eb 100644
--- a/ipc/shm.c
+++ b/ipc/shm.c
@@ -1201,9 +1201,9 @@ SYSCALL_DEFINE3(shmctl, int, shmid, int, cmd, struct shmid_ds __user *, buf)
1201struct compat_shmid_ds { 1201struct compat_shmid_ds {
1202 struct compat_ipc_perm shm_perm; 1202 struct compat_ipc_perm shm_perm;
1203 int shm_segsz; 1203 int shm_segsz;
1204 compat_time_t shm_atime; 1204 old_time32_t shm_atime;
1205 compat_time_t shm_dtime; 1205 old_time32_t shm_dtime;
1206 compat_time_t shm_ctime; 1206 old_time32_t shm_ctime;
1207 compat_ipc_pid_t shm_cpid; 1207 compat_ipc_pid_t shm_cpid;
1208 compat_ipc_pid_t shm_lpid; 1208 compat_ipc_pid_t shm_lpid;
1209 unsigned short shm_nattch; 1209 unsigned short shm_nattch;
diff --git a/ipc/syscall.c b/ipc/syscall.c
index 65d405f1ba0c..1ac06e3983c0 100644
--- a/ipc/syscall.c
+++ b/ipc/syscall.c
@@ -35,7 +35,7 @@ SYSCALL_DEFINE6(ipc, unsigned int, call, int, first, unsigned long, second,
35 (const struct __kernel_timespec __user *)fifth); 35 (const struct __kernel_timespec __user *)fifth);
36 else if (IS_ENABLED(CONFIG_COMPAT_32BIT_TIME)) 36 else if (IS_ENABLED(CONFIG_COMPAT_32BIT_TIME))
37 return compat_ksys_semtimedop(first, ptr, second, 37 return compat_ksys_semtimedop(first, ptr, second,
38 (const struct compat_timespec __user *)fifth); 38 (const struct old_timespec32 __user *)fifth);
39 else 39 else
40 return -ENOSYS; 40 return -ENOSYS;
41 41
diff --git a/ipc/util.h b/ipc/util.h
index 0a159f69b3bb..1ee81bce25e9 100644
--- a/ipc/util.h
+++ b/ipc/util.h
@@ -266,7 +266,7 @@ long ksys_shmctl(int shmid, int cmd, struct shmid_ds __user *buf);
266/* for CONFIG_ARCH_WANT_OLD_COMPAT_IPC */ 266/* for CONFIG_ARCH_WANT_OLD_COMPAT_IPC */
267long compat_ksys_semtimedop(int semid, struct sembuf __user *tsems, 267long compat_ksys_semtimedop(int semid, struct sembuf __user *tsems,
268 unsigned int nsops, 268 unsigned int nsops,
269 const struct compat_timespec __user *timeout); 269 const struct old_timespec32 __user *timeout);
270#ifdef CONFIG_COMPAT 270#ifdef CONFIG_COMPAT
271long compat_ksys_semctl(int semid, int semnum, int cmd, int arg); 271long compat_ksys_semctl(int semid, int semnum, int cmd, int arg);
272long compat_ksys_msgctl(int msqid, int cmd, void __user *uptr); 272long compat_ksys_msgctl(int msqid, int cmd, void __user *uptr);