From patchwork Thu Aug 3 02:51:12 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deepa Dinamani X-Patchwork-Id: 9878057 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 44C73603F4 for ; Thu, 3 Aug 2017 02:54:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 36752285C6 for ; Thu, 3 Aug 2017 02:54:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2A91628500; Thu, 3 Aug 2017 02:54:05 +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 B7CEE285C6 for ; Thu, 3 Aug 2017 02:54:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752334AbdHCCxJ (ORCPT ); Wed, 2 Aug 2017 22:53:09 -0400 Received: from mail-pf0-f194.google.com ([209.85.192.194]:37363 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752174AbdHCCwO (ORCPT ); Wed, 2 Aug 2017 22:52:14 -0400 Received: by mail-pf0-f194.google.com with SMTP id p13so174651pfd.4; Wed, 02 Aug 2017 19:52:14 -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=lHxbRRAOa7+OG7GEHL+DwRCitELtvpElgdKVUmz57Sc=; b=gN+ZW6g3RkVYC7Hhhzg4/nqkWVgn3541fgMnljBh9xkZkz46koMfbJo4/RfqwvNXnI Y6IX1XuU8imz0xKEhL3B2pvRi5N6rTthp29SAPTCHRDzw3bT9f96WkirqnCvP6VA0rh5 lkqJCIdRqlzIjMo3M1DoDQXBddfY1wVa5lDBs6PhExqJVA0+XUvityd2U6BkpwvQXQIY VXWGQJBjUHmWlvTsO367lgSsihAzl1yuyiUq6Psf+HfASbSGmTO7fN2q4MZ0akQKBt66 8NvMM+eAnIWEjeSPnIQJ1nNkdFkTPNxGjoIDZMX9zcoJL0pDsFV/PKtgPMEDndckQz6k GRkQ== 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=lHxbRRAOa7+OG7GEHL+DwRCitELtvpElgdKVUmz57Sc=; b=eXPPrsGQHWwCCkpUveE01X6Tl8gEKJVDYL+PVgHEq1HpEejv67Mpx1uxucxgfPL5Zr vqqZKoi5EGGr/496csXPT1ls8RK6+K7VkfPu+UsFn6l/w0JVBmvB48ZUkALswhg0eFwL TFQyRPOL/pPmMOoLg7I7R/s8Hz/+GynuCggwJI1YwyBj9fR/LnL9lQFkbDXkuG+toyn4 mgFY5b4aZF2dLzsc1tlsy2OllyvLjcMqe/O2ndyE6jC7SwP1pVoq5Ei7dq8AtBQGbb4f cAMBu4dfR838AfzEe2qBfBhO7QmJ0U6E4OoR0DS104VBgXND5pSByrrp9BoXwZDZY67D F+KQ== X-Gm-Message-State: AIVw112Q+qkbYiuG+aW3iHjWVDltSykfXx2AfwzP4+I+2SVc6bE0uZWz bj6itlyHMx13FTCc X-Received: by 10.84.194.163 with SMTP id h32mr222579pld.74.1501728734485; Wed, 02 Aug 2017 19:52:14 -0700 (PDT) Received: from localhost.localdomain ([2601:647:5000:6620:ec84:96b1:7dd3:7554]) by smtp.gmail.com with ESMTPSA id s11sm43489784pfi.24.2017.08.02.19.52.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 02 Aug 2017 19:52:13 -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 v3 3/6] ipc: msg: Make msg_queue timestamps y2038 safe Date: Wed, 2 Aug 2017 19:51:12 -0700 Message-Id: <20170803025115.24678-4-deepa.kernel@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170803025115.24678-1-deepa.kernel@gmail.com> References: <20170803025115.24678-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 Reviewed-by: Arnd Bergmann --- include/linux/msg.h | 7 ++++--- ipc/msg.c | 6 +++--- 2 files changed, 7 insertions(+), 6 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..3ad9ab829eaf 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,