Re: gettimeofday((void *)-1, NULL) implicates core dump on recent FreeBSD 11-CURRENT

From: Andriy Gapon <avg_at_FreeBSD.org>
Date: Wed, 08 Jul 2015 23:55:49 +0300
On 08/07/2015 22:22, Garrett Cooper wrote:
> On Jul 8, 2015, at 12:17, Doug Rabson <dfr_at_rabson.org> 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
Received on Wed Jul 08 2015 - 18:56:48 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:58 UTC