diff options
author | Arnd Bergmann <arnd@arndb.de> | 2018-04-12 09:19:44 -0400 |
---|---|---|
committer | Arnd Bergmann <arnd@arndb.de> | 2018-04-20 10:20:18 -0400 |
commit | 2a70b7879b84d471fd0e440f027bba310e0c1fb7 (patch) | |
tree | ffb63998dfdb5fdd2636874299c9785c1271ee71 | |
parent | b497ef570ecdeeaef4335ecc4f712cbaae0918a5 (diff) |
y2038: ipc: Use ktime_get_real_seconds consistently
In some places, we still used get_seconds() instead of
ktime_get_real_seconds(), and I'm changing the remaining ones now to
all use ktime_get_real_seconds() so we use the full available range for
timestamps instead of overflowing the 'unsigned long' return value in
year 2106 on 32-bit kernels.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
-rw-r--r-- | ipc/msg.c | 6 | ||||
-rw-r--r-- | ipc/sem.c | 6 |
2 files changed, 6 insertions, 6 deletions
@@ -758,7 +758,7 @@ static inline int pipelined_send(struct msg_queue *msq, struct msg_msg *msg, | |||
758 | WRITE_ONCE(msr->r_msg, ERR_PTR(-E2BIG)); | 758 | WRITE_ONCE(msr->r_msg, ERR_PTR(-E2BIG)); |
759 | } else { | 759 | } else { |
760 | ipc_update_pid(&msq->q_lrpid, task_pid(msr->r_tsk)); | 760 | ipc_update_pid(&msq->q_lrpid, task_pid(msr->r_tsk)); |
761 | msq->q_rtime = get_seconds(); | 761 | msq->q_rtime = ktime_get_real_seconds(); |
762 | 762 | ||
763 | wake_q_add(wake_q, msr->r_tsk); | 763 | wake_q_add(wake_q, msr->r_tsk); |
764 | WRITE_ONCE(msr->r_msg, msg); | 764 | WRITE_ONCE(msr->r_msg, msg); |
@@ -859,7 +859,7 @@ static long do_msgsnd(int msqid, long mtype, void __user *mtext, | |||
859 | } | 859 | } |
860 | 860 | ||
861 | ipc_update_pid(&msq->q_lspid, task_tgid(current)); | 861 | ipc_update_pid(&msq->q_lspid, task_tgid(current)); |
862 | msq->q_stime = get_seconds(); | 862 | msq->q_stime = ktime_get_real_seconds(); |
863 | 863 | ||
864 | if (!pipelined_send(msq, msg, &wake_q)) { | 864 | if (!pipelined_send(msq, msg, &wake_q)) { |
865 | /* no one is waiting for this message, enqueue it */ | 865 | /* no one is waiting for this message, enqueue it */ |
@@ -1087,7 +1087,7 @@ static long do_msgrcv(int msqid, void __user *buf, size_t bufsz, long msgtyp, in | |||
1087 | 1087 | ||
1088 | list_del(&msg->m_list); | 1088 | list_del(&msg->m_list); |
1089 | msq->q_qnum--; | 1089 | msq->q_qnum--; |
1090 | msq->q_rtime = get_seconds(); | 1090 | msq->q_rtime = ktime_get_real_seconds(); |
1091 | ipc_update_pid(&msq->q_lrpid, task_tgid(current)); | 1091 | ipc_update_pid(&msq->q_lrpid, task_tgid(current)); |
1092 | msq->q_cbytes -= msg->m_ts; | 1092 | msq->q_cbytes -= msg->m_ts; |
1093 | atomic_sub(msg->m_ts, &ns->msg_bytes); | 1093 | atomic_sub(msg->m_ts, &ns->msg_bytes); |
@@ -104,7 +104,7 @@ struct sem { | |||
104 | /* that alter the semaphore */ | 104 | /* that alter the semaphore */ |
105 | struct list_head pending_const; /* pending single-sop operations */ | 105 | struct list_head pending_const; /* pending single-sop operations */ |
106 | /* that do not alter the semaphore*/ | 106 | /* that do not alter the semaphore*/ |
107 | time_t sem_otime; /* candidate for sem_otime */ | 107 | time64_t sem_otime; /* candidate for sem_otime */ |
108 | } ____cacheline_aligned_in_smp; | 108 | } ____cacheline_aligned_in_smp; |
109 | 109 | ||
110 | /* One sem_array data structure for each set of semaphores in the system. */ | 110 | /* One sem_array data structure for each set of semaphores in the system. */ |
@@ -984,10 +984,10 @@ again: | |||
984 | static void set_semotime(struct sem_array *sma, struct sembuf *sops) | 984 | static void set_semotime(struct sem_array *sma, struct sembuf *sops) |
985 | { | 985 | { |
986 | if (sops == NULL) { | 986 | if (sops == NULL) { |
987 | sma->sems[0].sem_otime = get_seconds(); | 987 | sma->sems[0].sem_otime = ktime_get_real_seconds(); |
988 | } else { | 988 | } else { |
989 | sma->sems[sops[0].sem_num].sem_otime = | 989 | sma->sems[sops[0].sem_num].sem_otime = |
990 | get_seconds(); | 990 | ktime_get_real_seconds(); |
991 | } | 991 | } |
992 | } | 992 | } |
993 | 993 | ||