y2038: ipc: Report long times to user space

The shmid64_ds/semid64_ds/msqid64_ds data structures have been extended
to contain extra fields for storing the upper bits of the time stamps,
this patch does the other half of the job and and fills the new fields on
32-bit architectures as well as 32-bit tasks running on a 64-bit kernel
in compat mode.

There should be no change for native 64-bit tasks.

Signed-off-by: Arnd Bergmann <[email protected]>
This commit is contained in:
Arnd Bergmann 2015-04-28 21:39:50 +02:00
commit c2ab975c30
3 changed files with 33 additions and 9 deletions

View file

@ -1002,6 +1002,11 @@ static int shmctl_stat(struct ipc_namespace *ns, int shmid,
tbuf->shm_atime = shp->shm_atim;
tbuf->shm_dtime = shp->shm_dtim;
tbuf->shm_ctime = shp->shm_ctim;
#ifndef CONFIG_64BIT
tbuf->shm_atime_high = shp->shm_atim >> 32;
tbuf->shm_dtime_high = shp->shm_dtim >> 32;
tbuf->shm_ctime_high = shp->shm_ctim >> 32;
#endif
tbuf->shm_cpid = pid_vnr(shp->shm_cprid);
tbuf->shm_lpid = pid_vnr(shp->shm_lprid);
tbuf->shm_nattch = shp->shm_nattch;
@ -1233,9 +1238,12 @@ static int copy_compat_shmid_to_user(void __user *buf, struct shmid64_ds *in,
struct compat_shmid64_ds v;
memset(&v, 0, sizeof(v));
to_compat_ipc64_perm(&v.shm_perm, &in->shm_perm);
v.shm_atime = in->shm_atime;
v.shm_dtime = in->shm_dtime;
v.shm_ctime = in->shm_ctime;
v.shm_atime = lower_32_bits(in->shm_atime);
v.shm_atime_high = upper_32_bits(in->shm_atime);
v.shm_dtime = lower_32_bits(in->shm_dtime);
v.shm_dtime_high = upper_32_bits(in->shm_dtime);
v.shm_ctime = lower_32_bits(in->shm_ctime);
v.shm_ctime_high = upper_32_bits(in->shm_ctime);
v.shm_segsz = in->shm_segsz;
v.shm_nattch = in->shm_nattch;
v.shm_cpid = in->shm_cpid;