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

y2038: xtensa: Extend sysvipc data structures

xtensa, 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.

xtensa tries hard to define the structures so they work
in both big-endian and little-endian systems with padding
on the right side.
However, they only succeeded for for two of the three structures,
and their struct shmid64_ds ended up being defined in two
identical copies, and the big-endian one is wrong.

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>

+28 -51
+12 -13
arch/xtensa/include/uapi/asm/msgbuf.h
··· 7 7 * between kernel and user space. 8 8 * 9 9 * Pad space is left for: 10 - * - 64-bit time_t to solve y2038 problem 11 10 * - 2 miscellaneous 32-bit values 12 11 * 13 12 * This file is subject to the terms and conditions of the GNU General ··· 20 21 struct msqid64_ds { 21 22 struct ipc64_perm msg_perm; 22 23 #ifdef __XTENSA_EB__ 23 - unsigned int __unused1; 24 - __kernel_time_t msg_stime; /* last msgsnd time */ 25 - unsigned int __unused2; 26 - __kernel_time_t msg_rtime; /* last msgrcv time */ 27 - unsigned int __unused3; 28 - __kernel_time_t msg_ctime; /* last change time */ 24 + unsigned long msg_stime_high; 25 + unsigned long msg_stime; /* last msgsnd time */ 26 + unsigned long msg_rtime_high; 27 + unsigned long msg_rtime; /* last msgrcv time */ 28 + unsigned long msg_ctime_high; 29 + unsigned long msg_ctime; /* last change time */ 29 30 #elif defined(__XTENSA_EL__) 30 - __kernel_time_t msg_stime; /* last msgsnd time */ 31 - unsigned int __unused1; 32 - __kernel_time_t msg_rtime; /* last msgrcv time */ 33 - unsigned int __unused2; 34 - __kernel_time_t msg_ctime; /* last change time */ 35 - unsigned int __unused3; 31 + unsigned long msg_stime; /* last msgsnd time */ 32 + unsigned long msg_stime_high; 33 + unsigned long msg_rtime; /* last msgrcv time */ 34 + unsigned long msg_rtime_high; 35 + unsigned long msg_ctime; /* last change time */ 36 + unsigned long msg_ctime_high; 36 37 #else 37 38 # error processor byte order undefined! 38 39 #endif
+8 -9
arch/xtensa/include/uapi/asm/sembuf.h
··· 14 14 * between kernel and user space. 15 15 * 16 16 * Pad space is left for: 17 - * - 64-bit time_t to solve y2038 problem 18 17 * - 2 miscellaneous 32-bit values 19 18 * 20 19 */ ··· 26 27 struct semid64_ds { 27 28 struct ipc64_perm sem_perm; /* permissions .. see ipc.h */ 28 29 #ifdef __XTENSA_EL__ 29 - __kernel_time_t sem_otime; /* last semop time */ 30 - unsigned long __unused1; 31 - __kernel_time_t sem_ctime; /* last change time */ 32 - unsigned long __unused2; 30 + unsigned long sem_otime; /* last semop time */ 31 + unsigned long sem_otime_high; 32 + unsigned long sem_ctime; /* last change time */ 33 + unsigned long sem_ctime_high; 33 34 #else 34 - unsigned long __unused1; 35 - __kernel_time_t sem_otime; /* last semop time */ 36 - unsigned long __unused2; 37 - __kernel_time_t sem_ctime; /* last change time */ 35 + unsigned long sem_otime_high; 36 + unsigned long sem_otime; /* last semop time */ 37 + unsigned long sem_ctime_high; 38 + unsigned long sem_ctime; /* last change time */ 38 39 #endif 39 40 unsigned long sem_nsems; /* no. of semaphores in array */ 40 41 unsigned long __unused3;
+8 -29
arch/xtensa/include/uapi/asm/shmbuf.h
··· 4 4 * 5 5 * The shmid64_ds structure for Xtensa architecture. 6 6 * Note extra padding because this structure is passed back and forth 7 - * between kernel and user space. 7 + * between kernel and user space, but the padding is on the wrong 8 + * side for big-endian xtensa, for historic reasons. 8 9 * 9 10 * Pad space is left for: 10 - * - 64-bit time_t to solve y2038 problem 11 11 * - 2 miscellaneous 32-bit values 12 12 * 13 13 * This file is subject to the terms and conditions of the GNU General Public ··· 20 20 #ifndef _XTENSA_SHMBUF_H 21 21 #define _XTENSA_SHMBUF_H 22 22 23 - #if defined (__XTENSA_EL__) 24 23 struct shmid64_ds { 25 24 struct ipc64_perm shm_perm; /* operation perms */ 26 25 size_t shm_segsz; /* size of segment (bytes) */ 27 - __kernel_time_t shm_atime; /* last attach time */ 28 - unsigned long __unused1; 29 - __kernel_time_t shm_dtime; /* last detach time */ 30 - unsigned long __unused2; 31 - __kernel_time_t shm_ctime; /* last change time */ 32 - unsigned long __unused3; 26 + unsigned long shm_atime; /* last attach time */ 27 + unsigned long shm_atime_high; 28 + unsigned long shm_dtime; /* last detach time */ 29 + unsigned long shm_dtime_high; 30 + unsigned long shm_ctime; /* last change time */ 31 + unsigned long shm_ctime_high; 33 32 __kernel_pid_t shm_cpid; /* pid of creator */ 34 33 __kernel_pid_t shm_lpid; /* pid of last operator */ 35 34 unsigned long shm_nattch; /* no. of current attaches */ 36 35 unsigned long __unused4; 37 36 unsigned long __unused5; 38 37 }; 39 - #elif defined (__XTENSA_EB__) 40 - struct shmid64_ds { 41 - struct ipc64_perm shm_perm; /* operation perms */ 42 - size_t shm_segsz; /* size of segment (bytes) */ 43 - __kernel_time_t shm_atime; /* last attach time */ 44 - unsigned long __unused1; 45 - __kernel_time_t shm_dtime; /* last detach time */ 46 - unsigned long __unused2; 47 - __kernel_time_t shm_ctime; /* last change time */ 48 - unsigned long __unused3; 49 - __kernel_pid_t shm_cpid; /* pid of creator */ 50 - __kernel_pid_t shm_lpid; /* pid of last operator */ 51 - unsigned long shm_nattch; /* no. of current attaches */ 52 - unsigned long __unused4; 53 - unsigned long __unused5; 54 - }; 55 - #else 56 - # error endian order not defined 57 - #endif 58 - 59 38 60 39 struct shminfo64 { 61 40 unsigned long shmmax;