From owner-freebsd-current@freebsd.org Wed Jul 8 20:56:48 2015 Return-Path: Delivered-To: freebsd-current@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4EE08997803 for ; Wed, 8 Jul 2015 20:56:48 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id 7C02B3EAA for ; Wed, 8 Jul 2015 20:56:47 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from porto.starpoint.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id XAA29771; Wed, 08 Jul 2015 23:56:45 +0300 (EEST) (envelope-from avg@FreeBSD.org) Received: from localhost ([127.0.0.1]) by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1ZCwOb-0008S6-0j; Wed, 08 Jul 2015 23:56:45 +0300 Message-ID: <559D8E55.9050600@FreeBSD.org> Date: Wed, 08 Jul 2015 23:55:49 +0300 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Garrett Cooper , Doug Rabson CC: Jamie Landeg-Jones , FreeBSD Current Subject: Re: gettimeofday((void *)-1, NULL) implicates core dump on recent FreeBSD 11-CURRENT References: <201507072241.t67MfsX5085860@hergotha.csail.mit.edu> <94BCDA65-5B86-4329-A312-4CB16E847B69@dons.net.au> <201507081616.t68GGcY9047713@dyslexicfish.net> <0C541CE5-C322-4273-AE0B-1ACAEACCA096@gmail.com> In-Reply-To: <0C541CE5-C322-4273-AE0B-1ACAEACCA096@gmail.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Jul 2015 20:56:48 -0000 On 08/07/2015 22:22, Garrett Cooper wrote: > On Jul 8, 2015, at 12:17, Doug Rabson wrote: > >> As far as I can tell, POSIX doesn't require either EFAULT or any other >> behaviour - the text in http://www.open-std.org/jtc1/sc22/open/n4217.pdf >> just says, "No errors are defined". Our man page is wrong and any real >> program which relies on gettimeofday not faulting when given bad inputs is >> broken. > > I would suggest the following: 1. Document behavior in NOTES about > gettimeofday returning EFAULT with the specific scenarios kib mentioned, > segfaulting otherwise (wordsmithing the actual info of course). Otherwise, it > might confuse people who look at the manpage later. 2. I’ll add a `#ifdef > __FreeBSD__` to the testcase which will then skip it, because it’s easier to > do that then test undefined behavior that only makes sense on NetBSD. I am not suggesting this but if our man pages used all capitals to signify important auxiliary verbs then the ERRORS sections would read as The following error codes MAY be set in errno: Perhaps in that case it would be more clear how 'MAY' differs from 'SHOULD' and 'MUST'. Of course, the manual pages seem to be too sloppy in this respect. Reference: https://www.ietf.org/rfc/rfc2119.txt -- Andriy Gapon