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

Garrett Cooper yaneurabeya at gmail.com
Wed Jul 8 19:22:03 UTC 2015


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.
Thanks!
-NGie
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 496 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.freebsd.org/pipermail/freebsd-current/attachments/20150708/3bb69584/attachment.bin>


More information about the freebsd-current mailing list