Bug 740299 - [RTC] - The ioctl RTC_IRPQ_READ doesn't return the correct value
Summary: [RTC] - The ioctl RTC_IRPQ_READ doesn't return the correct value
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: kernel
Version: 5.6
Hardware: Unspecified
OS: Linux
Target Milestone: rc
: ---
Assignee: Prarit Bhargava
QA Contact: Dong Zhu
Depends On:
Blocks: 758797
TreeView+ depends on / blocked
Reported: 2011-09-21 15:07 UTC by Olivier BONHOMME
Modified: 2014-03-17 01:47 UTC (History)
4 users (show)

Fixed In Version: kernel-2.6.18-300.el5
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2012-02-21 03:56:47 UTC

Attachments (Terms of Use)
Fix RTC Freq Read with hpet emulate enabled (481 bytes, patch)
2011-09-21 15:07 UTC, Olivier BONHOMME
no flags Details | Diff
RHEL5 fix for this issue (1.27 KB, patch)
2011-11-30 15:49 UTC, Prarit Bhargava
no flags Details | Diff

System ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2012:0150 normal SHIPPED_LIVE Moderate: Red Hat Enterprise Linux 5.8 kernel update 2012-02-21 07:35:24 UTC

Description Olivier BONHOMME 2011-09-21 15:07:50 UTC
Created attachment 524222 [details]
Fix RTC Freq Read with hpet emulate enabled

Description of problem:

After setting the frequency value for the RTC clock using the ioctl RTC_IRQP_SET, the value is correctly applied to the rtc clock but when reading it using the RTC_IRQP_READ ioctl, the returned value is incorrect and stays set to 1024 even with root rights.

This behaviour applies only when the HPET timer is enabled and when the RTC clock is compiled in the kernel and not in module. In that case, the HPET_EMULATE_RTC option is enabled and ONLY in that case, the returned value is incorrect.

This bug is due to the fact, that in the rtc.c file driver, when HPET_EMULATE_RTC is defined the rtc_freq is not set.

This issue has already been corrected in the upstream kernel but not backported in the RHEL kernel as described here : http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=61ca9daa2ca3022dc9cb22bd98e69c1b61e412ad. [^]

As an attachement, I created a patch in order to build the RPM considering the current SPEC file and sources provided by the SRPM.
Version-Release number of selected component (if applicable):

How reproducible:
Try to change the clock frequency using the RTC_IRQP_SET ioctl and try to read it with the RTC_IRQP_READ ioctl.

Steps to Reproduce:
1.Set the clock frequency with RTC_IRQP_SET
2.Check that the clock is correctly set
3.Read the clock frequency with RTC_IRQP_READ
Actual results:
The RTC_IRQP_READ returns the default value.

Expected results:
The RTC_IRQP_READ returns the set value.

Additional info: This bug has been open also in CentOS http://bugs.centos.org/view.php?id=5064

Comment 1 Prarit Bhargava 2011-11-30 15:49:00 UTC
Created attachment 538614 [details]
RHEL5 fix for this issue

Comment 2 RHEL Product and Program Management 2011-11-30 16:00:34 UTC
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux maintenance release.  Product Management has requested
further review of this request by Red Hat Engineering, for potential
inclusion in a Red Hat Enterprise Linux Update release for currently deployed
products.  This request is not yet committed for inclusion in an Update

Comment 5 Jarod Wilson 2011-12-05 14:48:30 UTC
Patch(es) available in kernel-2.6.18-300.el5
You can download this test kernel (or newer) from http://people.redhat.com/jwilson/el5/
Detailed testing feedback is always welcomed.
If you require guidance regarding testing, please ask the bug assignee.

Comment 8 Olivier BONHOMME 2012-02-17 08:25:21 UTC

Sorry for the delay but I was missing time for testing your kernel. So I just installed it on my system and here are the result of my test program : 

$ sudo ./rtc_test 
RTC Value is 64
SET return code = 0
RTC Value is 64

So the fix is okay for me.

Comment 9 errata-xmlrpc 2012-02-21 03:56:47 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.


Note You need to log in before you can comment on or make changes to this bug.