From patchwork Thu Aug 3 02:51:14 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deepa Dinamani X-Patchwork-Id: 9878051 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 27B0A603B4 for ; Thu, 3 Aug 2017 02:53:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 171AC2869C for ; Thu, 3 Aug 2017 02:53:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 090A628757; Thu, 3 Aug 2017 02:53:01 +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 817B32869C for ; Thu, 3 Aug 2017 02:53:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752285AbdHCCws (ORCPT ); Wed, 2 Aug 2017 22:52:48 -0400 Received: from mail-pf0-f193.google.com ([209.85.192.193]:37378 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752206AbdHCCwT (ORCPT ); Wed, 2 Aug 2017 22:52:19 -0400 Received: by mail-pf0-f193.google.com with SMTP id p13so174807pfd.4; Wed, 02 Aug 2017 19:52:19 -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=SfbighLjgdYTKokrxFVyfhnEZ8kC9wAK3ba3JzNPAMQ=; b=VowGZqLOWZUnbaOGo+t3f9ZRxxNtpJO+CA51Frdym7vZN/MOGlZkxPRZWrk53UES1Y alnhOfBqHBiHvsXvuP9D5SQxhC0AxrR92w6wNw1wzQMrCfSEmxEqMreuaqLZnXvmrf3f ka56vbpnJGdGbfXvQx55PE9Hvwzms2XWAf2BOutV/FjwLBhgxS/chXeBF0LxnuPG7pNc aiN2lcm1o8QZIDcBHM9VEh2jpqa/RAeiMb1Dt1ySxc6NN0WLzUj5yVAToY2QMvQdKw+M kc/tE9NOVo5DQWFxlWwXkBkv6xp58yTZSSlpq5ZLzuWJpyA4FxjMI9BeG+dQ9dRtvaNa WSfQ== 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=SfbighLjgdYTKokrxFVyfhnEZ8kC9wAK3ba3JzNPAMQ=; b=Alip7HFMgjMOx6s53mWrJ47yeE0mWY5z4KZtZ1d0dXwuDo0lHDATqwBrnKuOi9Boe2 p1kRu+LPRxpFpIJn1iYt56rZzXKbGQs0ibJKW10fDgg9YJOPb8LDnwbO8NGYqzVAA5sD 6WMKWm1PkE6xYA4WlFyrvbzlSa4R5HR5EDpXhTFZPrrfAZQAY8kvbVKl7kX9Fy0XiL1e F76xpizWm+jt5zpwh5iyuVwd6jGx46r/BY6kHJe11f6JCceLgSzXtjB7xDiU5nK9FhbL m4TBHvpUmPwXn+l3ypu7vsu8+yYAPNEuBsobDmu1XUdu+88Yyq3agSEX5aZVCxTsWUL/ 3uQQ== X-Gm-Message-State: AIVw112BpdP1ReW9B+D5SCX4SRCNLz7WyplHis0AC1Gnj1qyZTgieDwI WGEZWnTvL4CiUg== X-Received: by 10.99.54.9 with SMTP id d9mr151028pga.195.1501728738686; Wed, 02 Aug 2017 19:52:18 -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.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 02 Aug 2017 19:52:18 -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 5/6] ipc: shm: Make shmid_kernel timestamps y2038 safe Date: Wed, 2 Aug 2017 19:51:14 -0700 Message-Id: <20170803025115.24678-6-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/shm.h | 6 +++--- ipc/shm.c | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/linux/shm.h b/include/linux/shm.h index 04e881829625..7bb897b25309 100644 --- a/include/linux/shm.h +++ b/include/linux/shm.h @@ -12,9 +12,9 @@ struct shmid_kernel /* private to the kernel */ struct file *shm_file; unsigned long shm_nattch; unsigned long shm_segsz; - time_t shm_atim; - time_t shm_dtim; - time_t shm_ctim; + time64_t shm_atim; + time64_t shm_dtim; + time64_t shm_ctim; pid_t shm_cprid; pid_t shm_lprid; struct user_struct *mlock_user; diff --git a/ipc/shm.c b/ipc/shm.c index c547388487c1..478e7d44676a 100644 --- a/ipc/shm.c +++ b/ipc/shm.c @@ -199,7 +199,7 @@ static int __shm_open(struct vm_area_struct *vma) if (IS_ERR(shp)) return PTR_ERR(shp); - shp->shm_atim = get_seconds(); + shp->shm_atim = ktime_get_real_seconds(); shp->shm_lprid = task_tgid_vnr(current); shp->shm_nattch++; shm_unlock(shp); @@ -286,7 +286,7 @@ static void shm_close(struct vm_area_struct *vma) goto done; /* no-op */ shp->shm_lprid = task_tgid_vnr(current); - shp->shm_dtim = get_seconds(); + shp->shm_dtim = ktime_get_real_seconds(); shp->shm_nattch--; if (shm_may_destroy(ns, shp)) shm_destroy(ns, shp); @@ -592,7 +592,7 @@ static int newseg(struct ipc_namespace *ns, struct ipc_params *params) shp->shm_cprid = task_tgid_vnr(current); shp->shm_lprid = 0; shp->shm_atim = shp->shm_dtim = 0; - shp->shm_ctim = get_seconds(); + shp->shm_ctim = ktime_get_real_seconds(); shp->shm_segsz = size; shp->shm_nattch = 0; shp->shm_file = file; @@ -848,7 +848,7 @@ static int shmctl_down(struct ipc_namespace *ns, int shmid, int cmd, err = ipc_update_perm(&shmid64->shm_perm, ipcp); if (err) goto out_unlock0; - shp->shm_ctim = get_seconds(); + shp->shm_ctim = ktime_get_real_seconds(); break; default: err = -EINVAL; @@ -1588,7 +1588,7 @@ static int sysvipc_shm_proc_show(struct seq_file *s, void *it) seq_printf(s, "%10d %10d %4o " SIZE_SPEC " %5u %5u " - "%5lu %5u %5u %5u %5u %10lu %10lu %10lu " + "%5lu %5u %5u %5u %5u %10llu %10llu %10llu " SIZE_SPEC " " SIZE_SPEC "\n", shp->shm_perm.key, shp->shm_perm.id,