Kernel release status
Posted Feb 21, 2003 6:07 UTC (Fri) by
Ross (subscriber, #4065)
In reply to:
Kernel release status by zooko
Parent article:
Kernel release status
Yes, you are right that gettimeofday() can jump back if settimeofday() is used by the root user to change the time. Hmm... the root user, who is trusted with the ability to do anything, can break the monotonic guarantee. That's not surprising. The root user can break just about everything.
And I'm not saying you can't do time synchronization. You can. Getting the time right at boot is a start. Using NTP or something similar which doesn't change the time but changes the rate of time adjustment is another.
Of course if you absolutely don't trust it you can do it yourself. Just set up a timer and increment a variable yourself. Or use a separate process or thread doing usleep() or select(). It can't go backwards unless the system can somehow take back signals or scheduling time.
But don't forget, root can attach to your process with ptrace() and modify your variable. ;)
(
Log in to post comments)