Re: svn commit: r231383 - in head: lib/libutil usr.sbin/vipw
* John Baldwin , 20120213 17:26: > Eh, the BUG is still worth mentioning. By default FreeBSD only uses > second granularity for VFS timestamps, so two updates within a single > second is still racey. You can keep the code change, but I would > revert the manual page change to put the BUG back as your change > didn't remove it. I'll re-add it tomorrow. I do think I will extend the message a bit, stating that this is only a problem if your file system doesn't do fine-grained timestamps. -- Ed Schouten WWW: http://80386.nl/ pgpE0jtuf854Y.pgp Description: PGP signature
Re: svn commit: r231383 - in head: lib/libutil usr.sbin/vipw
On Friday, February 10, 2012 8:40:32 am Ed Schouten wrote: > Author: ed > Date: Fri Feb 10 13:40:32 2012 > New Revision: 231383 > URL: http://svn.freebsd.org/changeset/base/231383 > > Log: > Detect file modification properly by using tv_nsec. > > POSIX 2008 standardizes st_mtim, meaning we can simply use nanosecond > precision to detect file modification. > > MFC after: 2 weeks Eh, the BUG is still worth mentioning. By default FreeBSD only uses second granularity for VFS timestamps, so two updates within a single second is still racey. You can keep the code change, but I would revert the manual page change to put the BUG back as your change didn't remove it. -- John Baldwin ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r231383 - in head: lib/libutil usr.sbin/vipw
On Fri, 10 Feb 2012, Sergey Kandaurov wrote: On 10 February 2012 17:40, Ed Schouten wrote: Log: ?Detect file modification properly by using tv_nsec. ?POSIX 2008 standardizes st_mtim, meaning we can simply use nanosecond ?precision to detect file modification. I am not sure we can use subsecond precision there with currently set sysctl vfs.timestamp_precision=0. Also, not all file systems support even seconds precision. So the deleted BUGS section applies irrespective of vfs.timestamp_precision, except it doesn't describe the full extent of the problem. Sleeping for just 1 second is not enough if the timestamp precision is large. The BUGS section also applies respective of vfs.timestamp_precision, when the user uses the supported setting vfs.timestamp_precision=0. Of course, important databases that need POSIX semantics shouldn't be put on file systems without POSIX times, but you need a BUGS section somewhere to tell you not to do that. Bruce___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r231383 - in head: lib/libutil usr.sbin/vipw
On 10 February 2012 17:40, Ed Schouten wrote: > Author: ed > Date: Fri Feb 10 13:40:32 2012 > New Revision: 231383 > URL: http://svn.freebsd.org/changeset/base/231383 > > Log: > Detect file modification properly by using tv_nsec. > > POSIX 2008 standardizes st_mtim, meaning we can simply use nanosecond > precision to detect file modification. > I am not sure we can use subsecond precision there with currently set sysctl vfs.timestamp_precision=0. -- wbr, pluknet ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r231383 - in head: lib/libutil usr.sbin/vipw
Author: ed Date: Fri Feb 10 13:40:32 2012 New Revision: 231383 URL: http://svn.freebsd.org/changeset/base/231383 Log: Detect file modification properly by using tv_nsec. POSIX 2008 standardizes st_mtim, meaning we can simply use nanosecond precision to detect file modification. MFC after:2 weeks Modified: head/lib/libutil/pw_util.c head/usr.sbin/vipw/vipw.8 Modified: head/lib/libutil/pw_util.c == --- head/lib/libutil/pw_util.c Fri Feb 10 13:36:39 2012(r231382) +++ head/lib/libutil/pw_util.c Fri Feb 10 13:40:32 2012(r231383) @@ -347,7 +347,8 @@ pw_edit(int notsetuid) sigprocmask(SIG_SETMASK, &oldsigset, NULL); if (stat(tempname, &st2) == -1) return (-1); - return (st1.st_mtime != st2.st_mtime); + return (st1.st_mtim.tv_sec != st2.st_mtim.tv_sec || + st1.st_mtim.tv_nsec != st2.st_mtim.tv_nsec); } /* Modified: head/usr.sbin/vipw/vipw.8 == --- head/usr.sbin/vipw/vipw.8 Fri Feb 10 13:36:39 2012(r231382) +++ head/usr.sbin/vipw/vipw.8 Fri Feb 10 13:40:32 2012(r231383) @@ -28,7 +28,7 @@ .\" @(#)vipw.8 8.1 (Berkeley) 6/6/93 .\" $FreeBSD$ .\" -.Dd June 6, 1993 +.Dd February 10, 2011 .Dt VIPW 8 .Os .Sh NAME @@ -110,10 +110,3 @@ The .Nm utility appeared in .Bx 4.0 . -.Sh BUGS -The mechanism for checking for password file modifications requires that -.Ev EDITOR -run for at least one second. -Non-interactive editor scripts should invoke -.Xr sleep 1 -or equivalent to ensure this happens. ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"