Received: by 10.213.65.68 with SMTP id h4csp280841imn; Mon, 26 Mar 2018 21:44:18 -0700 (PDT) X-Google-Smtp-Source: AG47ELtLiEz+mFDROON+pqMtIxgLtIIrqANjhB8vlpcQAhJHkEjQwgIo85GVlbQ2E79GAObQk3hs X-Received: by 2002:a17:902:102:: with SMTP id 2-v6mr43438390plb.48.1522125858926; Mon, 26 Mar 2018 21:44:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522125858; cv=none; d=google.com; s=arc-20160816; b=Itz3bG5ELxeOh5poWlisS83IMj2+pX7auZ3I/S6RYlSUG46Ln9HDSK5pYedwohjwrI sfLrhr3k39hRrja7znNcg7hcqQ2KFF+nk0zwtcIYwC0FSPAR/4+iSLjGW8WwZrubiY+e x6xV+RYgEA+7tqHy7/i/z8PoO+4NUEap+nnrbPpYlWarzEcAstmX3FRCHhT7A2F1/xW+ 0oIZpRNGE6ImH9vFgGgu5ah6YU+9o/H8uGaE/me7Vi76KwLT9bToPYtNj2sLhkEgZ5MX 65FGKf9AXE6bFhHeR8KPj4pfSBxi4+8V+ij+qRooq6kojeDWZok+EgnaNj277DretNM/ pdaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=GDfkuqcEhUIktmnU04cM3pVGy+mpQ7bcwKMYNtQbNf0=; b=i62tllT+yic16YviTS0WUqqLCLrPyZn3Kr8FWkx//BcthZGSEZRItT0R/8X5vQNVOF eS0/KUPupPFilAqtymLVHufXybdEwkMYAgOTjOCc3HZMb0FWAiUHtO0vRMyg4WwbQAb4 x5gVHXiCSizum7bb+UYC/vITTcH/yQu7YjAvFjfXE0tmXXR0zRSi38Yy8Yt8oFq+zHwL k7p7bNDoQXaVeVvl8/Oh+Avs62liYkdRHotA43ndIU0I+COqAEUrITfUPLQ1jEmWpBBe dGlsQVhkfCcP1bR7o7X4cGudGplyGPFuw1od/CJimP5QPUrOXJZrl4FOGa+UQfvvnlKm PCRA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=e8+z/rrD; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e21si285440pgv.513.2018.03.26.21.44.04; Mon, 26 Mar 2018 21:44:18 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=e8+z/rrD; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750942AbeC0EnI (ORCPT + 99 others); Tue, 27 Mar 2018 00:43:08 -0400 Received: from mail-io0-f195.google.com ([209.85.223.195]:42548 "EHLO mail-io0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750742AbeC0EnE (ORCPT ); Tue, 27 Mar 2018 00:43:04 -0400 Received: by mail-io0-f195.google.com with SMTP id d5so25892700iob.9; Mon, 26 Mar 2018 21:43:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=GDfkuqcEhUIktmnU04cM3pVGy+mpQ7bcwKMYNtQbNf0=; b=e8+z/rrDLbIa2WGz9YTLtCMZ5ataZrae4q+gpc9sA5wGhbenZ6m5E+hrk2fakvQMOO pfvADjeLptZaJn5v/HhXfxCuya2bxoMS7GpQXacKB4QawquuG5Dgbhv7zOrDJQ87cjhe sptu2+HCp4rERau/eUgGXyJ7x4uF4ORZKaSMtSqr9R70UfLK4sUbdSLZNB2XgmAWAJV1 MrHo01izt+/tSajznXqV+yDrOwb2V5dkJPooq4HQx3ts1WQPXt/g+YGwda106N8aIZrZ g6Zq6L6iSI7aB4KelOHV9CCTO0fCFcfrVixmiH2lCc15DaC4F1iHR4jMfCZxbMztOrYr QyIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=GDfkuqcEhUIktmnU04cM3pVGy+mpQ7bcwKMYNtQbNf0=; b=nz6/EBkAgspAdOEZA6qWjTwDpng/sKwDWlHQIoCZSkArf706tmi/AhknstA8OYYhj6 XT/U4BFjYymtpPLABDkzbTixFs5WyJs3bmSLBgxfMtDx39QtGKbdPk+BleL57Ab3IJGS N+SlslRyVwnImY5GpAv/A18DV/prfdUj9tEuFHLupxPVKVnQUe7YYmaZh18rAcDukwYP +PyFOS3PAPlywg3oIYjPoe5CO5DQcArooCFg86NqRG+9lu5jJR/xhHmsH1+M2p297dls B5WtJrCCxqTzKdCEoGtWPZSpnh8UTbKWEox7lvnk1r/wn3wr9UtXhyYdYNbE3cO4ADEV MBOg== X-Gm-Message-State: AElRT7EoYudGZvzLQD0JHrZ1UTsCHN8QToCKFVoa4HdXiaPgV6ju1bCR uFFXRO5t4c+ExJXPDG1xi2q+kMptZfX3Oh502SU= X-Received: by 10.107.170.224 with SMTP id g93mr22891123ioj.285.1522125784193; Mon, 26 Mar 2018 21:43:04 -0700 (PDT) MIME-Version: 1.0 Received: by 10.79.228.133 with HTTP; Mon, 26 Mar 2018 21:43:03 -0700 (PDT) In-Reply-To: <20180326215522.GA409@bombadil.infradead.org> References: <1513172572-16724-1-git-send-email-thunder.leizhen@huawei.com> <20171213141112.GA11217@bombadil.infradead.org> <20171213193100.GA19700@bombadil.infradead.org> <5A31ED86.5000800@huawei.com> <20180102145155.GD8222@bombadil.infradead.org> <20180326215522.GA409@bombadil.infradead.org> From: Deepa Dinamani Date: Mon, 26 Mar 2018 21:43:03 -0700 Message-ID: Subject: Re: [PATCH 1/1] aio: make sure the input "timeout" value is valid To: Matthew Wilcox Cc: Arnd Bergmann , Jeff Moyer , "Leizhen (ThunderTown)" , Alexander Viro , Benjamin LaHaise , linux-fsdevel , linux-aio , linux-kernel , Tianhong Ding , Hanjun Guo , Libin , Kefeng Wang Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Mar 26, 2018 at 2:55 PM, Matthew Wilcox wrote: > On Mon, Mar 26, 2018 at 10:01:30PM +0200, Arnd Bergmann wrote: >> I had suggested a more complete helper function at some point, >> to take care of all combinations of checking/non-checking, 32/64 >> bit, microsecond/nanosecond, and zeroing/checking the upper 32 bits >> of nanoseconds before comparing against 1 billion, but Deepa >> thought that was overkill, so I didn't continue that. > > Yeah, that sounds like a nightmare to use ;-) > >> For all I can tell, the get_timespec64() helper should almost always >> include the check, the one exception I know is utimensat() and related >> functions that may encode the special UTIME_NOW and UTIME_OMIT >> constants in the nanoseconds. > > So do you endorse the get_valid_timespec64() patch I posted up-thread? > We can't just make get_timespec64 return an errno directly because it'll > require changing all the users. I missed this thread earlier. I had leaned away from this idea before, because of the special cases which don't need it. I was also trying to keep the syntax close to copy_from_user(), which is what was there before. We could probably just change all the get_timespec64()/compat_get_timespec64() to do the check using a simple coccinelle script. I can own this. But, this would not be needed if Arnd is posting the other helper function. Arnd, let me know what you prefer here. -Deepa