From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL autolearn=ham autolearn_force=no version=3.4.2 Received: from mother.openwall.net (mother.openwall.net [195.42.179.200]) by inbox.vuxu.org (OpenSMTPD) with SMTP id 3f6da17f for ; Sun, 1 Mar 2020 08:38:08 +0000 (UTC) Received: (qmail 16114 invoked by uid 550); 1 Mar 2020 08:38:06 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com Received: (qmail 16094 invoked from network); 1 Mar 2020 08:38:05 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1583051873; bh=lKY6ohPnX0FBjaLjPOz8w0PnOUshLx0jS4uOmLH5c1s=; h=X-UI-Sender-Class:Date:From:To:Subject:References:In-Reply-To; b=W1aAumOI6PrE1LRPU9V09zShXbLEVwwRvdYz9H2JyZIsvOWLfsUa8VXjUxuSKAXHW lFEfzJp5yjS1C6MjL7CmpxSlAaflz1kYiVbKZdoVuszN3do6JW9BQ3z3Uw0OSpk+4i d0dPY+H6/N6neMs4Of6B9SpkorX/p69PlRkECZkU= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Date: Sun, 1 Mar 2020 09:37:53 +0100 From: Markus Wichmann To: musl@lists.openwall.com Message-ID: <20200301083753.GC2769@voyager> References: <20200301065730.146013-1-liujie1@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200301065730.146013-1-liujie1@huawei.com> User-Agent: Mutt/1.9.4 (2018-02-28) X-Provags-ID: V03:K1:MOiYg4Jr6OT9UKfiwtf2mfSwIPCUyFbOf3PEfinDL8Pv7myZgq+ 7q7lC8SikELDmV/x4K6kmNc3/GFypAIwRyJokVKLLo8RMypKETYtEd1bLCiK32L8wVgTTTO GEqCnR64WRQsIv4xYUY8NchwLUONZEpel8pKEFcGPPtwa5ziw/GLM+adscAYb2yKmlQwacY E0XVTE5MP8x+jdszIiVVg== X-UI-Out-Filterresults: notjunk:1;V03:K0:NeQTXVBkWOs=:rnlMudHb9DenVxCCAtWiKZ vEdltSfkYnBbwa2iP2Sj4WBbGROFo29qoJ8yvtBF5trzsB1IA03Fpk2P7OSVmVRWBwDhfpI/Y o+u9Z/xLRrCqZS4RSfT+wJH1PyE2YnLzmSTvMfCnjvoU4mGBmkqfJ6C0T2/7RXk4bf/iFp7gr A2GHhb+1WipkbAdt1ITkeqAgQ/1d/CmolJ+6x/fYtV2XXLoH+2v5S5cFnCAAKo5oHQWC432MB DE3WJggMJJRxTljCnTbuqw6wUypYRov4vRbrnsDpMOTp3zDFbRluBDcjMJIGSQaXEZl/d6SZ4 M+yIvB+PbEet/hzwBxXZYfiCjom4Tx7t1+9ktpFnP0cW9syHIHGCvkIS7DkG7wTw/wyyywc9S VjwVUVqJUp3w/mQW8HNz9kb+SdpySyaaK3tHMUU0bveNFNh/otLgT034g/iKouRokM+e/BOSW WCivwM4ENEEGcCZnrjut+n669IuXAcunSEo4bGB11pQjOjGAWeML8Pin5yMEeiEr0LW48VSRh iAVJcmLQ02jtBqFHGjk4RgSZuEW/xRdlpqiLTpTHtC9RPAZJB5Dle5wEC0rg21wBRGkuOerXH MJkgHDE6zAaesjLSmzF95AVbhMHGp5jeJCWKAPLemPpBAVoKhEu3+2+gLtw2a5fiH7XjyMAla suJ/1DeYR8zNzVKMUXSLxFkfQNX9DGCaLwU4YjmbqdPNvJL3udfPxB0hCYWcH22U6N7b1yImr HHnLOSBm1PQca65anR9ZmCg8fvqrZxV1nPw1IFONJ2xyyOyuhpUNSIZvWYYMWoPgag8griB9y tbn0Uruu5Ok55c81mZyawuImqAoNbuU3Ibmb1sQ2HIJwZ/Myw/VtAAw6Uvbz8W5OFfypRDbYi audATeF5Dd+lPKIo53WSw5D9pfnxBdJcy1ZtE7AgQrr+3OeEYYIBVLRl+0WE5UN1CV7zxbu5F uQjBZ9ripEV9BrxZK7S8WjXOpcCCoaTDONWUjm3simEOGvw3PLXiqN3a58HxCsSIGxsAawO+O 2IgTxfW51S4PTQZJ7yDqsCpn0gHMW062SIinDxYri9z/DVKHLhi1S7Edf2wgs9AW8yFMCR6Oh l8rc8Bsd6T0wCPe06Fv3V7V+13YniPXc7T36fWjA1cVo+BDXf3knNYF5E0qf7VDDPaHxXBF2h sJLaxVrjfYNxxXgEqHSnAzUrrS2glnsi1weeUJ6bEuz/8k9jAaUjNYoE1DJ4c3r0Rs2BHL7Iq i/DgFbdE5mcr8T9SM Content-Transfer-Encoding: quoted-printable Subject: Re: [musl] [PATCH] musl: lutimes: Add checks for input parameters On Sun, Mar 01, 2020 at 02:57:30PM +0800, Liu Jie wrote: > For the input parameter struct timeval tv, need to > determine whether it is invalid inputs. > Why? lutimes() is a Linux-specific function, so the manpage is as close to a specification as you're ever going to get, and it does not specify an EINVAL return. Adding the NULL pointer check, though, is probably justified, given that the manpage states that lutimes() acts "in the same way as utimes(2)" (with an irrelevant exception afterwards), and utimes() allows for a NULL tv input. The kernel itself also checks the input values again. While I usually am in favor of failing faster, in this case I fail to see the benefit. Especially since you're not testing for the one case that could make the kernel accept a timestamp that was invalid on input: An overflowing one. But you don't test for the upper limit. Oh, and the seconds are allowed to be negative. If someone wants to set a timestamp from before 1970, the libc is the wrong place to stop them. If such dates are invalid from your application's perspective, filter that there. Have a nice Sunday, Markus