Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

y2038: powerpc: Extend sysvipc data structures

powerpc, uses a nonstandard variation of the generic sysvipc
data structures, intended to have the padding moved around
so it can deal with big-endian 32-bit user space that has
64-bit time_t.

powerpc has the same definition as parisc and sparc, but now also
supports little-endian mode, which is now wrong because the
padding is made for big-endian user space.

This takes just take the same approach here that we have for
the asm-generic headers and adds separate 32-bit fields for the
upper halves of the timestamps, to let libc deal with the mess
in user space.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>

+40 -43
+16 -16
arch/powerpc/include/asm/compat.h
··· 162 162 163 163 struct compat_semid64_ds { 164 164 struct compat_ipc64_perm sem_perm; 165 - unsigned int __unused1; 166 - compat_time_t sem_otime; 167 - unsigned int __unused2; 168 - compat_time_t sem_ctime; 165 + unsigned int sem_otime_high; 166 + unsigned int sem_otime; 167 + unsigned int sem_ctime_high; 168 + unsigned int sem_ctime; 169 169 compat_ulong_t sem_nsems; 170 170 compat_ulong_t __unused3; 171 171 compat_ulong_t __unused4; ··· 173 173 174 174 struct compat_msqid64_ds { 175 175 struct compat_ipc64_perm msg_perm; 176 - unsigned int __unused1; 177 - compat_time_t msg_stime; 178 - unsigned int __unused2; 179 - compat_time_t msg_rtime; 180 - unsigned int __unused3; 181 - compat_time_t msg_ctime; 176 + unsigned int msg_stime_high; 177 + unsigned int msg_stime; 178 + unsigned int msg_rtime_high; 179 + unsigned int msg_rtime; 180 + unsigned int msg_ctime_high; 181 + unsigned int msg_ctime; 182 182 compat_ulong_t msg_cbytes; 183 183 compat_ulong_t msg_qnum; 184 184 compat_ulong_t msg_qbytes; ··· 190 190 191 191 struct compat_shmid64_ds { 192 192 struct compat_ipc64_perm shm_perm; 193 - unsigned int __unused1; 194 - compat_time_t shm_atime; 195 - unsigned int __unused2; 196 - compat_time_t shm_dtime; 197 - unsigned int __unused3; 198 - compat_time_t shm_ctime; 193 + unsigned int shm_atime_high; 194 + unsigned int shm_atime; 195 + unsigned int shm_dtime_high; 196 + unsigned int shm_dtime; 197 + unsigned int shm_ctime_high; 198 + unsigned int shm_ctime; 199 199 unsigned int __unused4; 200 200 compat_size_t shm_segsz; 201 201 compat_pid_t shm_cpid;
+9 -9
arch/powerpc/include/uapi/asm/msgbuf.h
··· 10 10 11 11 struct msqid64_ds { 12 12 struct ipc64_perm msg_perm; 13 - #ifndef __powerpc64__ 14 - unsigned int __unused1; 15 - #endif 13 + #ifdef __powerpc64__ 16 14 __kernel_time_t msg_stime; /* last msgsnd time */ 17 - #ifndef __powerpc64__ 18 - unsigned int __unused2; 19 - #endif 20 15 __kernel_time_t msg_rtime; /* last msgrcv time */ 21 - #ifndef __powerpc64__ 22 - unsigned int __unused3; 23 - #endif 24 16 __kernel_time_t msg_ctime; /* last change time */ 17 + #else 18 + unsigned long msg_stime_high; 19 + unsigned long msg_stime; /* last msgsnd time */ 20 + unsigned long msg_rtime_high; 21 + unsigned long msg_rtime; /* last msgrcv time */ 22 + unsigned long msg_ctime_high; 23 + unsigned long msg_ctime; /* last change time */ 24 + #endif 25 25 unsigned long msg_cbytes; /* current number of bytes on queue */ 26 26 unsigned long msg_qnum; /* number of messages in queue */ 27 27 unsigned long msg_qbytes; /* max number of bytes on queue */
+7 -7
arch/powerpc/include/uapi/asm/sembuf.h
··· 15 15 * between kernel and user space. 16 16 * 17 17 * Pad space is left for: 18 - * - 64-bit time_t to solve y2038 problem 19 - * - 2 miscellaneous 32-bit values 18 + * - 2 miscellaneous 32/64-bit values 20 19 */ 21 20 22 21 struct semid64_ds { 23 22 struct ipc64_perm sem_perm; /* permissions .. see ipc.h */ 24 23 #ifndef __powerpc64__ 25 - unsigned long __unused1; 26 - #endif 24 + unsigned long sem_otime_high; 25 + unsigned long sem_otime; /* last semop time */ 26 + unsigned long sem_ctime_high; 27 + unsigned long sem_ctime; /* last change time */ 28 + #else 27 29 __kernel_time_t sem_otime; /* last semop time */ 28 - #ifndef __powerpc64__ 29 - unsigned long __unused2; 30 - #endif 31 30 __kernel_time_t sem_ctime; /* last change time */ 31 + #endif 32 32 unsigned long sem_nsems; /* no. of semaphores in array */ 33 33 unsigned long __unused3; 34 34 unsigned long __unused4;
+8 -11
arch/powerpc/include/uapi/asm/shmbuf.h
··· 16 16 * between kernel and user space. 17 17 * 18 18 * Pad space is left for: 19 - * - 64-bit time_t to solve y2038 problem 20 19 * - 2 miscellaneous 32-bit values 21 20 */ 22 21 23 22 struct shmid64_ds { 24 23 struct ipc64_perm shm_perm; /* operation perms */ 25 - #ifndef __powerpc64__ 26 - unsigned long __unused1; 27 - #endif 24 + #ifdef __powerpc64__ 28 25 __kernel_time_t shm_atime; /* last attach time */ 29 - #ifndef __powerpc64__ 30 - unsigned long __unused2; 31 - #endif 32 26 __kernel_time_t shm_dtime; /* last detach time */ 33 - #ifndef __powerpc64__ 34 - unsigned long __unused3; 35 - #endif 36 27 __kernel_time_t shm_ctime; /* last change time */ 37 - #ifndef __powerpc64__ 28 + #else 29 + unsigned long shm_atime_high; 30 + unsigned long shm_atime; /* last attach time */ 31 + unsigned long shm_dtime_high; 32 + unsigned long shm_dtime; /* last detach time */ 33 + unsigned long shm_ctime_high; 34 + unsigned long shm_ctime; /* last change time */ 38 35 unsigned long __unused4; 39 36 #endif 40 37 size_t shm_segsz; /* size of segment (bytes) */