From patchwork Fri Jul 28 18:06:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deepa Dinamani X-Patchwork-Id: 9869203 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 662A760382 for ; Fri, 28 Jul 2017 18:08:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 66E6D288B8 for ; Fri, 28 Jul 2017 18:08:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5BD58288E6; Fri, 28 Jul 2017 18:08:21 +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 0FFFC288B8 for ; Fri, 28 Jul 2017 18:08:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752703AbdG1SIG (ORCPT ); Fri, 28 Jul 2017 14:08:06 -0400 Received: from mail-pg0-f68.google.com ([74.125.83.68]:36560 "EHLO mail-pg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752292AbdG1SHM (ORCPT ); Fri, 28 Jul 2017 14:07:12 -0400 Received: by mail-pg0-f68.google.com with SMTP id y129so24273703pgy.3; Fri, 28 Jul 2017 11:07:12 -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=VxhvUr+93eXr10UdayxSTC8ldRfbEqZp/dxWTGuIOKWf4YTlC+l+yAIx26PglQexZ4 E+ZVhAmhGiieQsqaYtcVNBikid/Tc8nDKYbOSpLaybOVOytkuhnAPe8vaBicJfyYxtRF sXI1lGoRZaYs9673VzhNuuQ8u/HlFCzTQ+h+Fu5W71P5d0JsqjT2Re0Gya6do+iIJa4x wcn/fo3EqAGYDf23kfDOT9UX3iipTDPAw3MfkRmpFtE03dw2Dx0dSq0X4vb6H1ARHPpr 22qi7afeVndKoiYTzgweAEi+3c9Srql0RQjwgA1d44jtUCFPt5c+gv6pNCB4K17GDKa5 V5Xg== 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=Ont008UUdIKdQ4aHKgm6r1nKnDSVy2LFN6J04y+sPJwFruWvDFWCyEdHUuv7Ryk7FB VPLzaTITfxxrpwN6WlNkTBTCyX3P4xBrMKehBRiK45gKPYtybMYjDw3+EpZT5qAATQhK DrHBWaSkvU8wWsGsEaQHzoOhI347mODtq+5gSQtiH7NTBtRnove8HImUv7Z4POb9Jdbv qxr0abIrnwjTBlmZPDiJFbK7LcRr92oT5BMCgo4wNHOPuSktbuLvRo0rMd5fENE9ijd7 2AXhTHLqHEpYWVSpInRbIbW02w9iQj3HZcqgN3+Wngp1NhIIjx5Bua0B1ar3XQRw4WB8 G1CQ== X-Gm-Message-State: AIVw112hLHgh9znTujl11KkmRijyDi1c0lIjbJdNwcciI8y40mMCkGcm tEez8uZLVLC3QDxc X-Received: by 10.84.213.137 with SMTP id g9mr8599652pli.325.1501265232281; Fri, 28 Jul 2017 11:07:12 -0700 (PDT) Received: from localhost.localdomain ([2601:647:5000:6620:39fd:1b9c:c45:e526]) by smtp.gmail.com with ESMTPSA id e123sm38633162pfa.96.2017.07.28.11.07.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 28 Jul 2017 11:07:11 -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 3/6] ipc: msg: Make msg_queue timestamps y2038 safe Date: Fri, 28 Jul 2017 11:06:08 -0700 Message-Id: <20170728180611.11249-4-deepa.kernel@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170728180611.11249-1-deepa.kernel@gmail.com> References: <20170728180611.11249-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; }