From patchwork Fri Jul 28 18:06:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deepa Dinamani X-Patchwork-Id: 9869211 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 B9F7860382 for ; Fri, 28 Jul 2017 18:08:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B8F261FF82 for ; Fri, 28 Jul 2017 18:08:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AC646284AF; Fri, 28 Jul 2017 18:08:57 +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 689091FF82 for ; Fri, 28 Jul 2017 18:08:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752748AbdG1SIv (ORCPT ); Fri, 28 Jul 2017 14:08:51 -0400 Received: from mail-pf0-f196.google.com ([209.85.192.196]:38092 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752492AbdG1SHK (ORCPT ); Fri, 28 Jul 2017 14:07:10 -0400 Received: by mail-pf0-f196.google.com with SMTP id e3so3654951pfc.5; Fri, 28 Jul 2017 11:07:10 -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=sRQa3EQNklB8w+noNT3R2+VCAlHcRfFkiZup+mKK6Pd2so/DiUJm9UqNbTqcSU2Wia yzztXk9mtzw9a16W8JULWxdTPqxBIonUrmLYbK/l4luDppqXDPVy6hJdYfVbUtAxwbr/ Egc1hXMtMbBquK7rc/j1wY0iEGv6s3mQjuw3YRa2Tbn8LxDAU4FkYV3FpRz8o7ZimrnU H64Iv9V7qr/PZrjiLu7syV9M2UCS9YkmzXNblfvmlNlcLwb+Ge7s1XIEs5K0N82VO+AG e1/MQADvCc0O5aMHDOf/nMqFROTVl3rnNSTwHaLcOicUb7Pp0LssVEN3llOBstiK6BnX PLYA== 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=b5z2sh/ZHrlBOYWdHiNsJQaIBWUj7mc0n6NidBWg9ZnWadRDN/fkeQBCkfOy12kcTK CjDHy7fqvA9vPKclUDTm/Ut92+0kYjyn8XD1X4FEvEiH+hbQOQ6NK2sTekzCXk9Ta+Jn Bx5JyYhokTGx/q8BXUN9Wnbkb3em6d/FQfeaP19fiJHnjMZ2WhOkhQIIPUuJ2aWBlFWV 3K5E9vuoOmczWrpDQ2kfzduT5RWKmYTQLrcbUcVnWtdCDAG29tdYl5kFODBqLVKQLYqD eqICmljOpTrMBreJs4n7BLrnIcC0hjGcDobbjkN0hLJBWMO+51L4NenQZuUw5Irc1VZt lx1A== X-Gm-Message-State: AIVw110iK3BHd4QIMEvPfQefKRTz+Tsj5xhXfuwC4hNqSWGsMEjEMEvM Vjv2NUgEqe5xIA== X-Received: by 10.84.130.78 with SMTP id 72mr5309905plc.471.1501265229717; Fri, 28 Jul 2017 11:07:09 -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.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 28 Jul 2017 11:07:09 -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 1/6] ipc: Make sys_semtimedop() y2038 safe Date: Fri, 28 Jul 2017 11:06:06 -0700 Message-Id: <20170728180611.11249-2-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 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); }