From 8ffc428676510ddb3a2e8f36b4b392468827cce3 Mon Sep 17 00:00:00 2001 From: Tim Gardner Date: Thu, 25 Sep 2008 07:09:25 -0600 Subject: [PATCH] Disable the fallback clause in hwclock when /dev/rtc cannot be opened. hwclock should not access the x86 RTC using I/O instructions unless explicitly requested from the command line (--directisa). This issue was encountered while debugging a boot time race when hwclock.sh was run in parallel. Addresses-Ubuntu-Bug: 274402 Signed-off-by: Tim Gardner Signed-off-by: LaMont Jones --- hwclock/hwclock.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/hwclock/hwclock.c b/hwclock/hwclock.c index 48b47ade..94e06c7e 100644 --- a/hwclock/hwclock.c +++ b/hwclock/hwclock.c @@ -1031,8 +1031,18 @@ determine_clock_access_method(const bool user_requests_ISA) { if (!ur) ur = probe_for_kd_clock(); + /* + * This final clause is a really bad idea on x86/AT PCs. You run the + * risk of a race condition with another copy of hwclock + * that already has /dev/rtc open. The fallback case on + * x86 is to then raise I/O priviledge level and access + * the RTC CMOS directly using I/O instructions. Simultaneous + * access like that can really hose the RTC. + */ +#if !defined(__i386__) if (!ur && !user_requests_ISA) ur = probe_for_cmos_clock(); +#endif if (debug) { if (ur) -- 2.39.5