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 <arnd@arndb.de>
This commit is contained in:
Arnd Bergmann
2015-04-28 21:39:50 +02:00
parent 2a70b7879b
commit c2ab975c30
3 changed files with 33 additions and 9 deletions

View File

@@ -537,6 +537,11 @@ static int msgctl_stat(struct ipc_namespace *ns, int msqid,
p->msg_stime = msq->q_stime;
p->msg_rtime = msq->q_rtime;
p->msg_ctime = msq->q_ctime;
#ifndef CONFIG_64BIT
p->msg_stime_high = msq->q_stime >> 32;
p->msg_rtime_high = msq->q_rtime >> 32;
p->msg_ctime_high = msq->q_ctime >> 32;
#endif
p->msg_cbytes = msq->q_cbytes;
p->msg_qnum = msq->q_qnum;
p->msg_qbytes = msq->q_qbytes;
@@ -646,9 +651,12 @@ static int copy_compat_msqid_to_user(void __user *buf, struct msqid64_ds *in,
struct compat_msqid64_ds v;
memset(&v, 0, sizeof(v));
to_compat_ipc64_perm(&v.msg_perm, &in->msg_perm);
v.msg_stime = in->msg_stime;
v.msg_rtime = in->msg_rtime;
v.msg_ctime = in->msg_ctime;
v.msg_stime = lower_32_bits(in->msg_stime);
v.msg_stime_high = upper_32_bits(in->msg_stime);
v.msg_rtime = lower_32_bits(in->msg_rtime);
v.msg_rtime_high = upper_32_bits(in->msg_rtime);
v.msg_ctime = lower_32_bits(in->msg_ctime);
v.msg_ctime_high = upper_32_bits(in->msg_ctime);
v.msg_cbytes = in->msg_cbytes;
v.msg_qnum = in->msg_qnum;
v.msg_qbytes = in->msg_qbytes;