y2038: xtensa: Extend sysvipc data structures
authorArnd Bergmann <arnd@arndb.de>
Tue, 5 May 2015 21:19:43 +0000 (23:19 +0200)
committerArnd Bergmann <arnd@arndb.de>
Fri, 20 Apr 2018 14:20:15 +0000 (16:20 +0200)
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>
arch/xtensa/include/uapi/asm/msgbuf.h
arch/xtensa/include/uapi/asm/sembuf.h
arch/xtensa/include/uapi/asm/shmbuf.h

index 36e2e103ca385265dc624ca811b06d0ce3c0e4b3..d6915e9f071ce24d97dccd9bf110526a412b5c69 100644 (file)
@@ -7,7 +7,6 @@
  * between kernel and user space.
  *
  * Pad space is left for:
- * - 64-bit time_t to solve y2038 problem
  * - 2 miscellaneous 32-bit values
  *
  * This file is subject to the terms and conditions of the GNU General
 struct msqid64_ds {
        struct ipc64_perm msg_perm;
 #ifdef __XTENSA_EB__
-       unsigned int    __unused1;
-       __kernel_time_t msg_stime;      /* last msgsnd time */
-       unsigned int    __unused2;
-       __kernel_time_t msg_rtime;      /* last msgrcv time */
-       unsigned int    __unused3;
-       __kernel_time_t msg_ctime;      /* last change time */
+       unsigned long  msg_stime_high;
+       unsigned long  msg_stime;       /* last msgsnd time */
+       unsigned long  msg_rtime_high;
+       unsigned long  msg_rtime;       /* last msgrcv time */
+       unsigned long  msg_ctime_high;
+       unsigned long  msg_ctime;       /* last change time */
 #elif defined(__XTENSA_EL__)
-       __kernel_time_t msg_stime;      /* last msgsnd time */
-       unsigned int    __unused1;
-       __kernel_time_t msg_rtime;      /* last msgrcv time */
-       unsigned int    __unused2;
-       __kernel_time_t msg_ctime;      /* last change time */
-       unsigned int    __unused3;
+       unsigned long  msg_stime;       /* last msgsnd time */
+       unsigned long  msg_stime_high;
+       unsigned long  msg_rtime;       /* last msgrcv time */
+       unsigned long  msg_rtime_high;
+       unsigned long  msg_ctime;       /* last change time */
+       unsigned long  msg_ctime_high;
 #else
 # error processor byte order undefined!
 #endif
index f61b6331a10c055d61da8e112af9ba9be225eab0..09f348d643f11b9d986a2dd4a8730edb394f89c2 100644 (file)
@@ -14,7 +14,6 @@
  * between kernel and user space.
  *
  * Pad space is left for:
- * - 64-bit time_t to solve y2038 problem
  * - 2 miscellaneous 32-bit values
  *
  */
 struct semid64_ds {
        struct ipc64_perm sem_perm;             /* permissions .. see ipc.h */
 #ifdef __XTENSA_EL__
-       __kernel_time_t sem_otime;              /* last semop time */
-       unsigned long   __unused1;
-       __kernel_time_t sem_ctime;              /* last change time */
-       unsigned long   __unused2;
+       unsigned long   sem_otime;              /* last semop time */
+       unsigned long   sem_otime_high;
+       unsigned long   sem_ctime;              /* last change time */
+       unsigned long   sem_ctime_high;
 #else
-       unsigned long   __unused1;
-       __kernel_time_t sem_otime;              /* last semop time */
-       unsigned long   __unused2;
-       __kernel_time_t sem_ctime;              /* last change time */
+       unsigned long   sem_otime_high;
+       unsigned long   sem_otime;              /* last semop time */
+       unsigned long   sem_ctime_high;
+       unsigned long   sem_ctime;              /* last change time */
 #endif
        unsigned long   sem_nsems;              /* no. of semaphores in array */
        unsigned long   __unused3;
index 26550bdc84307c0155054b8bdacccacb36aaf171..554a57a6a90f9b0daa366c4137bd2d9f474ebe85 100644 (file)
@@ -4,10 +4,10 @@
  *
  * The shmid64_ds structure for Xtensa architecture.
  * Note extra padding because this structure is passed back and forth
- * between kernel and user space.
+ * between kernel and user space, but the padding is on the wrong
+ * side for big-endian xtensa, for historic reasons.
  *
  * Pad space is left for:
- * - 64-bit time_t to solve y2038 problem
  * - 2 miscellaneous 32-bit values
  *
  * This file is subject to the terms and conditions of the GNU General Public
 #ifndef _XTENSA_SHMBUF_H
 #define _XTENSA_SHMBUF_H
 
-#if defined (__XTENSA_EL__)
 struct shmid64_ds {
        struct ipc64_perm       shm_perm;       /* operation perms */
        size_t                  shm_segsz;      /* size of segment (bytes) */
-       __kernel_time_t         shm_atime;      /* last attach time */
-       unsigned long           __unused1;
-       __kernel_time_t         shm_dtime;      /* last detach time */
-       unsigned long           __unused2;
-       __kernel_time_t         shm_ctime;      /* last change time */
-       unsigned long           __unused3;
+       unsigned long           shm_atime;      /* last attach time */
+       unsigned long           shm_atime_high;
+       unsigned long           shm_dtime;      /* last detach time */
+       unsigned long           shm_dtime_high;
+       unsigned long           shm_ctime;      /* last change time */
+       unsigned long           shm_ctime_high;
        __kernel_pid_t          shm_cpid;       /* pid of creator */
        __kernel_pid_t          shm_lpid;       /* pid of last operator */
        unsigned long           shm_nattch;     /* no. of current attaches */
        unsigned long           __unused4;
        unsigned long           __unused5;
 };
-#elif defined (__XTENSA_EB__)
-struct shmid64_ds {
-       struct ipc64_perm       shm_perm;       /* operation perms */
-       size_t                  shm_segsz;      /* size of segment (bytes) */
-       __kernel_time_t         shm_atime;      /* last attach time */
-       unsigned long           __unused1;
-       __kernel_time_t         shm_dtime;      /* last detach time */
-       unsigned long           __unused2;
-       __kernel_time_t         shm_ctime;      /* last change time */
-       unsigned long           __unused3;
-       __kernel_pid_t          shm_cpid;       /* pid of creator */
-       __kernel_pid_t          shm_lpid;       /* pid of last operator */
-       unsigned long           shm_nattch;     /* no. of current attaches */
-       unsigned long           __unused4;
-       unsigned long           __unused5;
-};
-#else
-# error endian order not defined
-#endif
-
 
 struct shminfo64 {
        unsigned long   shmmax;