From patchwork Fri Jul 28 18:52:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deepa Dinamani X-Patchwork-Id: 9869263 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 84EAF60382 for ; Fri, 28 Jul 2017 18:53:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5805E288D2 for ; Fri, 28 Jul 2017 18:53:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4CB13288E6; Fri, 28 Jul 2017 18:53:52 +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 E1710288D2 for ; Fri, 28 Jul 2017 18:53:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752719AbdG1Sw4 (ORCPT ); Fri, 28 Jul 2017 14:52:56 -0400 Received: from mail-pg0-f65.google.com ([74.125.83.65]:33542 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752204AbdG1Swx (ORCPT ); Fri, 28 Jul 2017 14:52:53 -0400 Received: by mail-pg0-f65.google.com with SMTP id u185so2023228pgb.0; Fri, 28 Jul 2017 11:52:53 -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=HTNhgzZxaFVKqC3iO+0pCjX5v+y/dg7iPJiCQIVf0RZfc3qvz6CDUKh9gWwUY7yof1 OxwuMhryt/A6ZB++vKaXwV9RW9vgyJe3FOC+utnuBSSDE/w1PZXlJy5Tpr7sI/PtsKHV a7FCITUI2uOjxoHFQRV0vwzWUHPq11fqMGng3Gv5yzIpZJErOa5ZI3izkv0snSTmIyMg 2dNtDr1WH+jAFWdoSaS1+5ss6kVWlXZhWYhPojRYWbuBatEQupRvsYB6TKIyZ6i15uAw P9po7AAEkZnD1ltcVMigBx2OEbWUjTGlP6I7Yn+FuOOZ63IRvCSPFiXayfZfmWOW6Yjo pnYw== 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=hi/sYRoW9gt3p/0LvrJ63kvrTIHKyYfwEy0EWVG1xSngPmA/LGxVdVo4wPKAVo/K2L 8CrEGndg5OJ63BW5X1vqyL8U9Piq8G+GYjzjpBWB5EQKJADflLvsqV6sHmX9Kn4E+8jA Q+Llg/wkURiqJRpot2z9y6sgFZc9/lJ0FZTFErH+k2AuRGrHBh/L+VfhkwGr8cY3eBDa 5UVNWcwPNuRVTlYD6bMpMdEfrs6RTjMg58HEPb/FezGnjTczHjE1TNcE7C4lHC5twpuC PQNtVUEXyAZ00xp9E9y7TpsoQdJmVI9fFxEhww6KPiAfy9as140p6XrUovL9tpL+7/Mi JDcA== X-Gm-Message-State: AIVw113bnvaiDXPeHZPJGoI4OAVy3VTcSR6XAMTnKokAALaSytiFlrJh alpelJ52dBl0wA== X-Received: by 10.84.241.207 with SMTP id t15mr8985404plm.343.1501267973136; Fri, 28 Jul 2017 11:52:53 -0700 (PDT) Received: from localhost.localdomain ([2601:647:5000:6620:39fd:1b9c:c45:e526]) by smtp.gmail.com with ESMTPSA id x5sm38485095pgq.18.2017.07.28.11.52.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 28 Jul 2017 11:52:52 -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: [RESEND PATCH 3/6] ipc: msg: Make msg_queue timestamps y2038 safe Date: Fri, 28 Jul 2017 11:52:04 -0700 Message-Id: <20170728185207.12480-4-deepa.kernel@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170728185207.12480-1-deepa.kernel@gmail.com> References: <20170728185207.12480-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; }