ipc: msg: Make msg_queue timestamps y2038 safe

time_t is not y2038 safe. Replace all uses of
time_t by y2038 safe time64_t.

Similarly, replace the calls to get_seconds() with
y2038 safe ktime_get_real_seconds().
Note that this preserves fast access on 64 bit systems,
but 32 bit systems need sequence counters.

The syscall interfaces themselves are not changed as part of
the patch. They will be part of a different series.

Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

authored by

Deepa Dinamani and committed by
Al Viro
50578ea9 b9047726

+7 -6
+4 -3
include/linux/msg.h
··· 2 2 #define _LINUX_MSG_H 3 3 4 4 #include <linux/list.h> 5 + #include <linux/time64.h> 5 6 #include <uapi/linux/msg.h> 6 7 7 8 /* one msg_msg structure for each message */ ··· 18 17 /* one msq_queue structure for each present queue on the system */ 19 18 struct msg_queue { 20 19 struct kern_ipc_perm q_perm; 21 - time_t q_stime; /* last msgsnd time */ 22 - time_t q_rtime; /* last msgrcv time */ 23 - time_t q_ctime; /* last change time */ 20 + time64_t q_stime; /* last msgsnd time */ 21 + time64_t q_rtime; /* last msgrcv time */ 22 + time64_t q_ctime; /* last change time */ 24 23 unsigned long q_cbytes; /* current number of bytes on queue */ 25 24 unsigned long q_qnum; /* number of messages in queue */ 26 25 unsigned long q_qbytes; /* max number of bytes on queue */
+3 -3
ipc/msg.c
··· 133 133 } 134 134 135 135 msq->q_stime = msq->q_rtime = 0; 136 - msq->q_ctime = get_seconds(); 136 + msq->q_ctime = ktime_get_real_seconds(); 137 137 msq->q_cbytes = msq->q_qnum = 0; 138 138 msq->q_qbytes = ns->msg_ctlmnb; 139 139 msq->q_lspid = msq->q_lrpid = 0; ··· 406 406 407 407 msq->q_qbytes = msqid64->msg_qbytes; 408 408 409 - msq->q_ctime = get_seconds(); 409 + msq->q_ctime = ktime_get_real_seconds(); 410 410 /* 411 411 * Sleeping receivers might be excluded by 412 412 * stricter permissions. ··· 1181 1181 struct msg_queue *msq = it; 1182 1182 1183 1183 seq_printf(s, 1184 - "%10d %10d %4o %10lu %10lu %5u %5u %5u %5u %5u %5u %10lu %10lu %10lu\n", 1184 + "%10d %10d %4o %10lu %10lu %5u %5u %5u %5u %5u %5u %10llu %10llu %10llu\n", 1185 1185 msq->q_perm.key, 1186 1186 msq->q_perm.id, 1187 1187 msq->q_perm.mode,