From patchwork Fri Jul 28 18:52:02 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deepa Dinamani X-Patchwork-Id: 9869275 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 8438D60382 for ; Fri, 28 Jul 2017 18:55:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5706B288D2 for ; Fri, 28 Jul 2017 18:55:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4A16C288E6; Fri, 28 Jul 2017 18:55:04 +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 F1C16288D2 for ; Fri, 28 Jul 2017 18:55:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752704AbdG1Sww (ORCPT ); Fri, 28 Jul 2017 14:52:52 -0400 Received: from mail-pf0-f196.google.com ([209.85.192.196]:34884 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752204AbdG1Swv (ORCPT ); Fri, 28 Jul 2017 14:52:51 -0400 Received: by mail-pf0-f196.google.com with SMTP id q85so21259591pfq.2; Fri, 28 Jul 2017 11:52:50 -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=YAgh+MO2GAsFnh2cVzrOYL+2K9X6BE+mPokS3I00tVk=; b=u9P3zCDxa6i07dKWPsjpixHm1cW+tW02hx3+FM/PCy/Jal80zQAQ5Gkxco8HX2L20+ PpxP1xDnbSJjROyO2yqqK/tFybYOmQ6sxKNnmnI06Q+3+g3y/PRsYyE2PLKya8dWSLmt Bzsygn07QegKGdECYCh889M35YsWpgOl3ZjUgxS+q1pDJ2hX/qRK+2mI6s46cGdHT2Sh 5D/lN4RYqWybUwUNrZfA7FqB73JQU8QTPZ4QE6VIEiije4XZfXzgv+Z5zppdqljOjimb qVqswdMUlYCtk+9wxW0Ac9oG5DfWBY6zQOK4hlr0sLOmIwOaXOlymBbcaIS5XkIAv6Tv lZuw== 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=YAgh+MO2GAsFnh2cVzrOYL+2K9X6BE+mPokS3I00tVk=; b=ZXyRZsVGjt+QOgM5pRSr6UF1dUZfNtRUJ4Gor2cLjst1wyGmob9t/BRe+6+l2sd6yc 7ODq+plGnKtzGeaZRupfyh2/3kGZHTNL1WZxl9AUuy1mfs+CSsLSIvfVVoMZOjV/u1Ex yli+p7hLBj59XIR6gNORepJDS33up3ClE+0canRCE/rF568aiVrNJEycZFNRc1waHuX8 jkZyZN6c8S1+a/SdR5DtJh5spODMriYqFk/6F0K7Ok9OnteCdKe9jAC6fjRKIXnskr7s IOfPhelVHg6rxBIWX8XBLaH2mG2/z3FG0hlLf+cKhY5bnR92Aqhn0Kp+X32MIhpw6dwg j1HA== X-Gm-Message-State: AIVw111wbToi9qsb3wwJ1Ph+idaYooQdzj5jflnkxoqxxdneUBg1veLs HmfCwW6cOZrDcg== X-Received: by 10.84.218.140 with SMTP id r12mr3265042pli.127.1501267970551; Fri, 28 Jul 2017 11:52:50 -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.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 28 Jul 2017 11:52:50 -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 1/6] ipc: Make sys_semtimedop() y2038 safe Date: Fri, 28 Jul 2017 11:52:02 -0700 Message-Id: <20170728185207.12480-2-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 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 --- 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); }