From patchwork Sun Jul 30 22:30:03 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deepa Dinamani X-Patchwork-Id: 9870711 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id ABF7B60353 for ; Sun, 30 Jul 2017 22:31:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9ECF128575 for ; Sun, 30 Jul 2017 22:31:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 934462857B; Sun, 30 Jul 2017 22:31:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 48FC728575 for ; Sun, 30 Jul 2017 22:31:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751875AbdG3WbG (ORCPT ); Sun, 30 Jul 2017 18:31:06 -0400 Received: from mail-pg0-f65.google.com ([74.125.83.65]:33611 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751099AbdG3WaR (ORCPT ); Sun, 30 Jul 2017 18:30:17 -0400 Received: by mail-pg0-f65.google.com with SMTP id u185so6462406pgb.0; Sun, 30 Jul 2017 15:30:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=z1cdddr3NQ3olex+SYacUoyTasiJ02yog5ecHDklffI=; b=HtI9XI58uK0UPd9ag8yIMRii1FIPZFLAEQMyPhRCQo0Adzyts6Qmds5h4VzopjDa1/ vAJrj7ACzG8OHfTGyjJ+3EW4Q4kwNWADAx5O66Q8N7iHWyllLJUznLMYlHj8eJxeUHuS zgQj/V5qVntsupK7M5gNILPFcgE5j+aIp5FpAT9xymFYMdM3Tku2MUPa8mGff4Mc3mCY WJVDz4slYQwD8jH3H2p5QeL+ok4OxusdoqumOXTHi4Hm40f+28V9bAGMKtDwYw6Gq/P6 jLqM4HyHa0gkFgu2gZvCbrqAxri86cZtVcJ7IfOnKHOWAFjJPg/GYR+B6VPIsvxVQQsk NP2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=z1cdddr3NQ3olex+SYacUoyTasiJ02yog5ecHDklffI=; b=NQSHuEpNwRiwyksuZabj709UQdw4SVGfEsxBG8MgtpGusnIjPllw5aU9oFs60EWhkI 02vBRZwiEXvop8oXVVZhHpIB6cg0c1J2Jhkf/U2q1egXiP/Ak+YG/CXcirrEdBb0Oi7t 3KMivopLy48+8B6+btHG5BU3W/UUVhzDVNyot0io0Q6DiJ8+t0y24D7Vj2eVGyhRUkcc Z+n1qjewLRgJS9eZtSBj70D1eAYCdxP2KFiMdbWz6m4IwFU5itW5yBnWuqBPc8P39Zoj qDrw6jWEMllqK9I/2dygVjtFmgu2YAbyz4fz34L3kO93jR7ct2pxtrwU9Q2J40N+iMJr xSkg== X-Gm-Message-State: AIVw113u7eYzYxCsToNU4QldY0/czgqL6HZ89ppD3iwiZe/pG/WpcDdR gcWA4dW+M7S64qzn X-Received: by 10.98.14.10 with SMTP id w10mr14007676pfi.72.1501453817309; Sun, 30 Jul 2017 15:30:17 -0700 (PDT) Received: from localhost.localdomain ([2601:647:5000:6620:b1bb:905a:190e:8c7e]) by smtp.gmail.com with ESMTPSA id b24sm47763365pfh.53.2017.07.30.15.30.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 30 Jul 2017 15:30:16 -0700 (PDT) From: Deepa Dinamani 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: [PATCH v2 3/6] ipc: msg: Make msg_queue timestamps y2038 safe Date: Sun, 30 Jul 2017 15:30:03 -0700 Message-Id: <20170730223006.32661-4-deepa.kernel@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170730223006.32661-1-deepa.kernel@gmail.com> References: <20170730223006.32661-1-deepa.kernel@gmail.com> Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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 +#include #include /* 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; }