Skip to content

Commit d0b67de

Browse files
committed
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>
1 parent 91b9b0d commit d0b67de

4 files changed

Lines changed: 40 additions & 43 deletions

File tree

‎arch/powerpc/include/asm/compat.h‎

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -162,23 +162,23 @@ struct compat_ipc64_perm {
162162

163163
struct compat_semid64_ds {
164164
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;
169169
compat_ulong_t sem_nsems;
170170
compat_ulong_t __unused3;
171171
compat_ulong_t __unused4;
172172
};
173173

174174
struct compat_msqid64_ds {
175175
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;
182182
compat_ulong_t msg_cbytes;
183183
compat_ulong_t msg_qnum;
184184
compat_ulong_t msg_qbytes;
@@ -190,12 +190,12 @@ struct compat_msqid64_ds {
190190

191191
struct compat_shmid64_ds {
192192
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;
199199
unsigned int __unused4;
200200
compat_size_t shm_segsz;
201201
compat_pid_t shm_cpid;

‎arch/powerpc/include/uapi/asm/msgbuf.h‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,18 @@
1010

1111
struct msqid64_ds {
1212
struct ipc64_perm msg_perm;
13-
#ifndef __powerpc64__
14-
unsigned int __unused1;
15-
#endif
13+
#ifdef __powerpc64__
1614
__kernel_time_t msg_stime; /* last msgsnd time */
17-
#ifndef __powerpc64__
18-
unsigned int __unused2;
19-
#endif
2015
__kernel_time_t msg_rtime; /* last msgrcv time */
21-
#ifndef __powerpc64__
22-
unsigned int __unused3;
23-
#endif
2416
__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
2525
unsigned long msg_cbytes; /* current number of bytes on queue */
2626
unsigned long msg_qnum; /* number of messages in queue */
2727
unsigned long msg_qbytes; /* max number of bytes on queue */

‎arch/powerpc/include/uapi/asm/sembuf.h‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,20 @@
1515
* between kernel and user space.
1616
*
1717
* 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
2019
*/
2120

2221
struct semid64_ds {
2322
struct ipc64_perm sem_perm; /* permissions .. see ipc.h */
2423
#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
2729
__kernel_time_t sem_otime; /* last semop time */
28-
#ifndef __powerpc64__
29-
unsigned long __unused2;
30-
#endif
3130
__kernel_time_t sem_ctime; /* last change time */
31+
#endif
3232
unsigned long sem_nsems; /* no. of semaphores in array */
3333
unsigned long __unused3;
3434
unsigned long __unused4;

‎arch/powerpc/include/uapi/asm/shmbuf.h‎

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,25 +16,22 @@
1616
* between kernel and user space.
1717
*
1818
* Pad space is left for:
19-
* - 64-bit time_t to solve y2038 problem
2019
* - 2 miscellaneous 32-bit values
2120
*/
2221

2322
struct shmid64_ds {
2423
struct ipc64_perm shm_perm; /* operation perms */
25-
#ifndef __powerpc64__
26-
unsigned long __unused1;
27-
#endif
24+
#ifdef __powerpc64__
2825
__kernel_time_t shm_atime; /* last attach time */
29-
#ifndef __powerpc64__
30-
unsigned long __unused2;
31-
#endif
3226
__kernel_time_t shm_dtime; /* last detach time */
33-
#ifndef __powerpc64__
34-
unsigned long __unused3;
35-
#endif
3627
__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 */
3835
unsigned long __unused4;
3936
#endif
4037
size_t shm_segsz; /* size of segment (bytes) */

0 commit comments

Comments
 (0)