Date: Thu, 9 Jul 2015 08:27:17 +1000 From: Peter Jeremy <peter@rulingia.com> To: Garrett Cooper <yaneurabeya@gmail.com> Cc: Doug Rabson <dfr@rabson.org>, Jamie Landeg-Jones <jamie@dyslexicfish.net>, FreeBSD Current <freebsd-current@freebsd.org> Subject: Re: gettimeofday((void *)-1, NULL) implicates core dump on recent FreeBSD 11-CURRENT Message-ID: <20150708222717.GE98562@server.rulingia.com> In-Reply-To: <0C541CE5-C322-4273-AE0B-1ACAEACCA096@gmail.com> References: <CAPQ4ffuTcN_ytcH7GPY0s6OqWK9qo6MGaVZhOB%2B0ojWfd=fNCg@mail.gmail.com> <201507072241.t67MfsX5085860@hergotha.csail.mit.edu> <94BCDA65-5B86-4329-A312-4CB16E847B69@dons.net.au> <CAPQ4ffuuaiWGUthEhux2VrK6ZyHDT=0xd9z8k8f11N=6shdUng@mail.gmail.com> <201507081616.t68GGcY9047713@dyslexicfish.net> <CACA0VUhFjBhPMTr=QD71jEvis9CMSrnpyu=xFiXu27nLeozGJA@mail.gmail.com> <0C541CE5-C322-4273-AE0B-1ACAEACCA096@gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
[-- Attachment #1 --] On 2015-Jul-08 12:22:03 -0700, Garrett Cooper <yaneurabeya@gmail.com> wrote: >On Jul 8, 2015, at 12:17, Doug Rabson <dfr@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. I would suggest adding a comment to intro(2) noting that not all functions listed in section 2 are necessarily system calls and may report error conditions (or maybe "perform argument validation") differently when implemented in userland. Note that the issues with gettimeofday() also apply to clock_gettime(). I'm not sure if we want to explicitly document the conditions under which gettimeofday() (or clock_gettime()) are implemented in userland vs syscalls because that is guaranteed to get stale over time. How about stating that these functions are implemented as syscalls only if the AT_TIMEKEEP value reported by "procstat -x" is NULL. -- Peter Jeremy [-- Attachment #2 --] -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQJ8BAEBCgBmBQJVnaPFXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXRFRUIyOTg2QzMwNjcxRTc0RTY1QzIyN0Ux NkE1OTdBMEU0QTIwQjM0AAoJEBall6Dkogs0Q4kQAJ+Zm6B2zY1lA7CgheEfh8l+ g4Cz0G4isvmPq1GvjUSZzQbKxPzd9AKJGL7xggV5r32XrfeYK+ucas1rmsfQXINo LlEgZyZ8XnfBnzUJufWSJytBFgKbVGsqIkULtjR6ajMPMdiEFmipCh0s/Y1E8xIA SwXvqwSTa06r0c9C5mV0IhDSebDZHgucs9p++vUTbMKvzyASE8RJQNXe6Je2zFzX vJ9fkUMeykt9JvZANEkEK81PXG8jEfKCEG1V0OxD1fhf52wEEsW1J292wASJQoGK qv0tLDZ3ikzHkuQqYRuFUKVNsO+ezw5KMebZXJWhREbH2j8PdlOc7AOOZro8Yfbo F6zv829WOPUp6FZ8D0f+PoFfAvJknWP7t7Zw1Doqoenfi8dOldY5qYk816nu+rus B86hFh82SLwy77e/9YRBCSZGSL2kqPtAhV14nQdeqc2wlilal7hWVGDsDK5bmDUb G9GP1Bg704CGzOFDZNA/+dE/vT7aar0IS1TAdAGNZV/X0VPX29ONLJAfGVGpPwEa QYhTSmoiZI5q70fxLGjyBopOOgwVKD2AzcZWn7Z43uKEtHfe+dekYe/alMz9/4jk C0po3YwZRRNm68+Nf46JtVmp9+K2RrqHVu9ZfjqaZWiS4clByHW3TG9g1jfOgrGC V4+ctyukNlZLXgGnUnmU =MaeW -----END PGP SIGNATURE-----
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20150708222717.GE98562>
