From patchwork Thu Aug 3 02:51:10 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deepa Dinamani X-Patchwork-Id: 9878059 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 70679603FB 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 61C0928500 for ; Thu, 3 Aug 2017 02:54:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 56B1E285C6; 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 062FE2874E for ; Thu, 3 Aug 2017 02:54:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752138AbdHCCwH (ORCPT ); Wed, 2 Aug 2017 22:52:07 -0400 Received: from mail-pf0-f196.google.com ([209.85.192.196]:38787 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751206AbdHCCwE (ORCPT ); Wed, 2 Aug 2017 22:52:04 -0400 Received: by mail-pf0-f196.google.com with SMTP id e3so171737pfc.5; Wed, 02 Aug 2017 19:52:04 -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=pgsrUysMEoj/ByVzoEa4d4t+2lZAjF9EcCu8W4fcwLs=; b=C+WImvM+pMjYiRAiMB9RZ666sS0gNa+ixvdzXM6Etn8GBLhR2rv7Cbl1jRbmORB9mF sWBGZaXWI9vNs/MWlDInDjEHMR9U88VZb1T2NT0KN+rx5/IkYfxuBGY07xS814kb+WWD PHCa0Ap1RkhHgnHPzrgJzWNrQVB6/MTbzhGkcme+JARNIK53/PUwF1kk76Z80gu+bpTo OP4Lq4MBjY5VodkZ8nesXt1JClYmQB2R3+Gn86FTkk60gQmIKzR3YimcwpQTb405qR0m Su/JJgYI/y8MFbeRdNW+bJpoqulNxqwj1weOKqNoF8lvMCC0/QMyGywHzERg51HVkwmz H6Xg== 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=pgsrUysMEoj/ByVzoEa4d4t+2lZAjF9EcCu8W4fcwLs=; b=rqeY/FuiCQbncmRkkvBNWDPNa+xKLZq6q1qfiV9pmHJehhFszHCoSeYjTj9C5HMvyh nlSF1yRm21rW2EtzgYcrOvQ6UR+6zX2XuurvFEzK4BYCPImDhJWovD4+dC4G4EMqodiy LStSOIY+W7dMTHKNWusUzpQd5DXi89z1pEieUS56+3tyYVqPo5pb4dezUVfcaP+UZkF8 glGp0IEgdDvTOOCTinN5AJ8lvETsF09U7dQ8S9KmzFL/GTvXhmnzHpwtcWNaN45dlwsL 8pLLYUvUq9WEQhzCQNmBBybFrQgcrzdTX9X5AjYaZRpivtC9+nlPVAXKvHTPetil8kK5 KO6Q== X-Gm-Message-State: AIVw113lI4puMOQV//L6p8AAdkjvNZDrnVB6iLC5wkFAWc+nOZp7ohgH l+1rBwaUoDAoFA== X-Received: by 10.84.209.205 with SMTP id y71mr186213plh.85.1501728724345; Wed, 02 Aug 2017 19:52:04 -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.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 02 Aug 2017 19:52:03 -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 1/6] ipc: Make sys_semtimedop() y2038 safe Date: Wed, 2 Aug 2017 19:51:10 -0700 Message-Id: <20170803025115.24678-2-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 struct timespec is not y2038 safe on 32 bit machines. Replace timespec with y2038 safe struct timespec64. Note that the patch only changes the internals without modifying the syscall interface. This will be part of a separate series. Signed-off-by: Deepa Dinamani Reviewed-by: Arnd Bergmann --- ipc/sem.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ipc/sem.c b/ipc/sem.c index 8b3b40c54a58..b41cd00d104c 100644 --- a/ipc/sem.c +++ b/ipc/sem.c @@ -1861,7 +1861,7 @@ static struct sem_undo *find_alloc_undo(struct ipc_namespace *ns, int semid) } static long do_semtimedop(int semid, struct sembuf __user *tsops, - unsigned nsops, const struct timespec *timeout) + unsigned nsops, const struct timespec64 *timeout) { int error = -EINVAL; struct sem_array *sma; @@ -1897,7 +1897,7 @@ static long do_semtimedop(int semid, struct sembuf __user *tsops, error = -EINVAL; goto out_free; } - jiffies_left = timespec_to_jiffies(timeout); + jiffies_left = timespec64_to_jiffies(timeout); } max = 0; @@ -2116,8 +2116,8 @@ SYSCALL_DEFINE4(semtimedop, int, semid, struct sembuf __user *, tsops, unsigned, nsops, const struct timespec __user *, timeout) { if (timeout) { - struct timespec ts; - if (copy_from_user(&ts, timeout, sizeof(*timeout))) + struct timespec64 ts; + if (get_timespec64(&ts, timeout)) return -EFAULT; return do_semtimedop(semid, tsops, nsops, &ts); } @@ -2130,8 +2130,8 @@ COMPAT_SYSCALL_DEFINE4(semtimedop, int, semid, struct sembuf __user *, tsems, const struct compat_timespec __user *, timeout) { if (timeout) { - struct timespec ts; - if (compat_get_timespec(&ts, timeout)) + struct timespec64 ts; + if (compat_get_timespec64(&ts, timeout)) return -EFAULT; return do_semtimedop(semid, tsems, nsops, &ts); }