From owner-freebsd-current@freebsd.org Wed Jul 8 22:27:52 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 3767B9969B7 for ; Wed, 8 Jul 2015 22:27:52 +0000 (UTC) (envelope-from peter@rulingia.com) Received: from vps.rulingia.com (vps.rulingia.com [103.243.244.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "vps.rulingia.com", Issuer "CAcert Class 3 Root" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id D590A141A for ; Wed, 8 Jul 2015 22:27:51 +0000 (UTC) (envelope-from peter@rulingia.com) Received: from server.rulingia.com (c220-239-242-83.belrs5.nsw.optusnet.com.au [220.239.242.83]) by vps.rulingia.com (8.14.9/8.14.9) with ESMTP id t68MRPUX067823 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 9 Jul 2015 08:27:31 +1000 (AEST) (envelope-from peter@rulingia.com) X-Bogosity: Ham, spamicity=0.000000 Received: from server.rulingia.com (localhost.rulingia.com [127.0.0.1]) by server.rulingia.com (8.14.9/8.14.9) with ESMTP id t68MRI99043269 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 9 Jul 2015 08:27:18 +1000 (AEST) (envelope-from peter@server.rulingia.com) Received: (from peter@localhost) by server.rulingia.com (8.14.9/8.14.9/Submit) id t68MRHWG043262; Thu, 9 Jul 2015 08:27:17 +1000 (AEST) (envelope-from peter) Date: Thu, 9 Jul 2015 08:27:17 +1000 From: Peter Jeremy To: Garrett Cooper Cc: Doug Rabson , Jamie Landeg-Jones , FreeBSD Current Subject: Re: gettimeofday((void *)-1, NULL) implicates core dump on recent FreeBSD 11-CURRENT Message-ID: <20150708222717.GE98562@server.rulingia.com> 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> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="0lnxQi9hkpPO77W3" Content-Disposition: inline In-Reply-To: <0C541CE5-C322-4273-AE0B-1ACAEACCA096@gmail.com> X-PGP-Key: http://www.rulingia.com/keys/peter.pgp User-Agent: Mutt/1.5.23 (2014-03-12) 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 22:27:52 -0000 --0lnxQi9hkpPO77W3 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 2015-Jul-08 12:22:03 -0700, 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. 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. --=20 Peter Jeremy --0lnxQi9hkpPO77W3 Content-Type: application/pgp-signature -----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----- --0lnxQi9hkpPO77W3--