From: Deepa Dinamani <deepa.kernel@gmail.com>
To: viro@zeniv.linux.org.uk, linux-kernel@vger.kernel.org
Cc: linux-fsdevel@vger.kernel.org, arnd@arndb.de, y2038@lists.linaro.org
Subject: [RESEND PATCH 3/6] ipc: msg: Make msg_queue timestamps y2038 safe
Date: Fri, 28 Jul 2017 11:52:04 -0700 [thread overview]
Message-ID: <20170728185207.12480-4-deepa.kernel@gmail.com> (raw)
In-Reply-To: <20170728185207.12480-1-deepa.kernel@gmail.com>
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>
---
include/linux/msg.h | 7 ++++---
ipc/msg.c | 12 ++++++------
2 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/include/linux/msg.h b/include/linux/msg.h
index 4e5ec3cbf464..05115342daa3 100644
--- a/include/linux/msg.h
+++ b/include/linux/msg.h
@@ -2,6 +2,7 @@
#define _LINUX_MSG_H
#include <linux/list.h>
+#include <linux/time64.h>
#include <uapi/linux/msg.h>
/* one msg_msg structure for each message */
@@ -17,9 +18,9 @@ struct msg_msg {
/* one msq_queue structure for each present queue on the system */
struct msg_queue {
struct kern_ipc_perm q_perm;
- time_t q_stime; /* last msgsnd time */
- time_t q_rtime; /* last msgrcv time */
- time_t q_ctime; /* last change time */
+ time64_t q_stime; /* last msgsnd time */
+ time64_t q_rtime; /* last msgrcv time */
+ time64_t q_ctime; /* last change time */
unsigned long q_cbytes; /* current number of bytes on queue */
unsigned long q_qnum; /* number of messages in queue */
unsigned long q_qbytes; /* max number of bytes on queue */
diff --git a/ipc/msg.c b/ipc/msg.c
index 14369ad6c5ca..e967f0e3fe69 100644
--- a/ipc/msg.c
+++ b/ipc/msg.c
@@ -133,7 +133,7 @@ static int newque(struct ipc_namespace *ns, struct ipc_params *params)
}
msq->q_stime = msq->q_rtime = 0;
- msq->q_ctime = get_seconds();
+ msq->q_ctime = ktime_get_real_seconds();
msq->q_cbytes = msq->q_qnum = 0;
msq->q_qbytes = ns->msg_ctlmnb;
msq->q_lspid = msq->q_lrpid = 0;
@@ -406,7 +406,7 @@ static int msgctl_down(struct ipc_namespace *ns, int msqid, int cmd,
msq->q_qbytes = msqid64->msg_qbytes;
- msq->q_ctime = get_seconds();
+ msq->q_ctime = ktime_get_real_seconds();
/*
* Sleeping receivers might be excluded by
* stricter permissions.
@@ -1181,7 +1181,7 @@ static int sysvipc_msg_proc_show(struct seq_file *s, void *it)
struct msg_queue *msq = it;
seq_printf(s,
- "%10d %10d %4o %10lu %10lu %5u %5u %5u %5u %5u %5u %10lu %10lu %10lu\n",
+ "%10d %10d %4o %10lu %10lu %5u %5u %5u %5u %5u %5u %10llu %10llu %10llu\n",
msq->q_perm.key,
msq->q_perm.id,
msq->q_perm.mode,
@@ -1193,9 +1193,9 @@ static int sysvipc_msg_proc_show(struct seq_file *s, void *it)
from_kgid_munged(user_ns, msq->q_perm.gid),
from_kuid_munged(user_ns, msq->q_perm.cuid),
from_kgid_munged(user_ns, msq->q_perm.cgid),
- msq->q_stime,
- msq->q_rtime,
- msq->q_ctime);
+ (unsigned long long) msq->q_stime,
+ (unsigned long long) msq->q_rtime,
+ (unsigned long long) msq->q_ctime);
return 0;
}
--
2.11.0
next prev parent reply other threads:[~2017-07-28 18:52 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-28 18:52 [RESEND 0/6] Make ipc y2038 safe Deepa Dinamani
2017-07-28 18:52 ` [RESEND PATCH 1/6] ipc: Make sys_semtimedop() " Deepa Dinamani
2017-07-28 18:52 ` [RESEND PATCH 2/6] ipc: mqueue: Replace timespec with timespec64 Deepa Dinamani
2017-07-28 20:15 ` Paul Moore
2017-07-28 20:44 ` Deepa Dinamani
2017-07-28 21:02 ` Paul Moore
2017-07-28 21:06 ` Paul Moore
2017-07-28 21:25 ` Deepa Dinamani
2017-07-29 15:27 ` Richard Guy Briggs
2017-07-28 18:52 ` Deepa Dinamani [this message]
2017-07-28 18:52 ` [RESEND PATCH 4/6] ipc: sem: Make sem_array timestamps y2038 safe Deepa Dinamani
2017-07-28 18:52 ` [RESEND PATCH 5/6] ipc: shm: Make shmid_kernel " Deepa Dinamani
2017-07-28 18:52 ` [RESEND PATCH 6/6] utimes: Make utimes " Deepa Dinamani
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170728185207.12480-4-deepa.kernel@gmail.com \
--to=deepa.kernel@gmail.com \
--cc=arnd@arndb.de \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
--cc=y2038@lists.linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).