summaryrefslogtreecommitdiffstats
path: root/kernel/time/ntp.c
diff options
context:
space:
mode:
authorWang YanQing <udknight@gmail.com>2015-06-23 18:38:54 +0800
committerJohn Stultz <john.stultz@linaro.org>2015-08-17 11:24:54 -0700
commite1d7ba8735551ed79c7a0463a042353574b96da3 (patch)
treef15a9ef6516d689f6edaf062079000e32e8a7c77 /kernel/time/ntp.c
parentde4a95faf173be1e798c37ca486dfcb234a0941b (diff)
downloadblackbird-op-linux-e1d7ba8735551ed79c7a0463a042353574b96da3.tar.gz
blackbird-op-linux-e1d7ba8735551ed79c7a0463a042353574b96da3.zip
time: Always make sure wall_to_monotonic isn't positive
Two issues were found on an IMX6 development board without an enabled RTC device(resulting in the boot time and monotonic time being initialized to 0). Issue 1:exportfs -a generate: "exportfs: /opt/nfs/arm does not support NFS export" Issue 2:cat /proc/stat: "btime 4294967236" The same issues can be reproduced on x86 after running the following code: int main(void) { struct timeval val; int ret; val.tv_sec = 0; val.tv_usec = 0; ret = settimeofday(&val, NULL); return 0; } Two issues are different symptoms of same problem: The reason is a positive wall_to_monotonic pushes boot time back to the time before Epoch, and getboottime will return negative value. In symptom 1: negative boot time cause get_expiry() to overflow time_t when input expire time is 2147483647, then cache_flush() always clears entries just added in ip_map_parse. In symptom 2: show_stat() uses "unsigned long" to print negative btime value returned by getboottime. This patch fix the problem by prohibiting time from being set to a value which would cause a negative boot time. As a result one can't set the CLOCK_REALTIME time prior to (1970 + system uptime). Cc: Prarit Bhargava <prarit@redhat.com> Cc: Richard Cochran <richardcochran@gmail.com> Cc: Ingo Molnar <mingo@kernel.org> Cc: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Wang YanQing <udknight@gmail.com> [jstultz: reworded commit message] Signed-off-by: John Stultz <john.stultz@linaro.org>
Diffstat (limited to 'kernel/time/ntp.c')
0 files changed, 0 insertions, 0 deletions
OpenPOWER on IntegriCloud