[chrony/el6] support recent kernels (#982803)
Miroslav Lichvar
mlichvar at fedoraproject.org
Fri Jan 10 16:16:17 UTC 2014
commit 9eed5e52ba53ed90e8acc000ec348784bc6a4a34
Author: Miroslav Lichvar <mlichvar at redhat.com>
Date: Fri Jan 10 16:29:21 2014 +0100
support recent kernels (#982803)
chrony-kernel.patch | 159 +++++++++++++++++++++++++++++++++++++++++++++++++++
chrony.spec | 3 +
2 files changed, 162 insertions(+), 0 deletions(-)
---
diff --git a/chrony-kernel.patch b/chrony-kernel.patch
new file mode 100644
index 0000000..ec72e40
--- /dev/null
+++ b/chrony-kernel.patch
@@ -0,0 +1,159 @@
+commit ec7d302a6ca9e7974a05d338267b40491a1d7abb
+Author: Miroslav Lichvar <mlichvar at redhat.com>
+Date: Mon Jun 6 13:56:27 2011 +0200
+
+ Support Linux 3.0 and later
+
+diff --git a/sys_linux.c b/sys_linux.c
+index 441e6e4..24f027c 100644
+--- a/sys_linux.c
++++ b/sys_linux.c
+@@ -960,7 +960,9 @@ get_version_specific_details(void)
+ if (uname(&uts) < 0) {
+ LOG_FATAL(LOGF_SysLinux, "Cannot uname(2) to get kernel version, sorry.");
+ }
+- if (sscanf(uts.release, "%d.%d.%d", &major, &minor, &patch) != 3) {
++
++ patch = 0;
++ if (sscanf(uts.release, "%d.%d.%d", &major, &minor, &patch) < 2) {
+ LOG_FATAL(LOGF_SysLinux, "Cannot read information from uname, sorry");
+ }
+
+@@ -1039,21 +1041,21 @@ get_version_specific_details(void)
+ half-second intervals. */
+ tick_update_hz = 2;
+ }
+- /* Let's be optimistic that these will be the same until proven
+- otherwise :-) */
+- case 7:
+- case 8:
++ /* fall through */
++ default:
+ /* These don't seem to need scaling */
+ freq_scale = 1.0;
+ have_readonly_adjtime = 2;
+ have_nanopll = 1;
+ break;
+- default:
+- LOG_FATAL(LOGF_SysLinux, "Kernel version not supported yet, sorry.");
+ }
+ break;
+ default:
+- LOG_FATAL(LOGF_SysLinux, "Kernel's major version not supported yet, sorry");
++ /* Let's be optimistic that these will be the same until proven
++ otherwise :-) */
++ freq_scale = 1.0;
++ have_readonly_adjtime = 2;
++ have_nanopll = 1;
+ break;
+ }
+
+commit 6a2a837ede0a3a6f6ca1deb8a17fc113e2f658b4
+Author: Miroslav Lichvar <mlichvar at redhat.com>
+Date: Mon Jun 6 21:32:38 2011 +0200
+
+ Remove kernel version check from rtc code
+
+ It should work with all currently supported kernels (>= 2.2.0).
+
+diff --git a/rtc_linux.c b/rtc_linux.c
+index 7f53da8..2308cc8 100644
+--- a/rtc_linux.c
++++ b/rtc_linux.c
+@@ -507,62 +507,6 @@ write_coefs_to_file(int valid,time_t ref_time,double offset,double rate)
+ int
+ RTC_Linux_Initialise(void)
+ {
+- int major, minor, patch;
+-
+- /* Check whether we can support the real time clock.
+-
+- Linux 1.2.x - haven't checked yet
+-
+- Linux 1.3.x - don't know, haven't got a system to look at
+-
+- Linux 2.0.x - For x<=31, using any variant of the adjtimex() call
+- sets the kernel into a mode where the RTC was updated every 11
+- minutes. The only way to escape this is to use settimeofday().
+- Since we need to have sole control over the RTC to be able to
+- measure its drift rate, and there is no 'notify' callback to warn
+- you that the kernel is going to do this, I can't see a way to
+- support this.
+-
+- Linux 2.0.x - For x>=32 the adjtimex()/RTC behaviour was
+- modified, so that as long as the STA_UNSYNC flag is set the RTC
+- is left alone. This is the mode we exploit here, so that the RTC
+- continues to go its own sweet way, unless we make updates to it
+- from this module.
+-
+- Linux 2.1.x - don't know, haven't got a system to look at.
+-
+- Linux 2.2.x, 2.3.x and 2.4.x are believed to be OK for all
+- patch levels
+-
+- */
+-
+- SYS_Linux_GetKernelVersion(&major, &minor, &patch);
+-
+- /* Obviously this test can get more elaborate when we know about
+- more system types. */
+- if (major != 2) {
+- return 0;
+- } else {
+- switch (minor) {
+- case 0:
+- if (patch <= 31) {
+- return 0;
+- }
+- break;
+- case 1:
+- return 0;
+- break;
+- case 2:
+- case 3:
+- case 4:
+- case 5:
+- case 6:
+- case 7:
+- case 8:
+- break; /* OK for all patch levels */
+- }
+- }
+-
+ /* Setup details depending on configuration options */
+ setup_config();
+
+diff --git a/sys_linux.c b/sys_linux.c
+index a0321e7..8b3bcfc 100644
+--- a/sys_linux.c
++++ b/sys_linux.c
+@@ -1087,16 +1087,6 @@ SYS_Linux_Finalise(void)
+
+ /* ================================================== */
+
+-void
+-SYS_Linux_GetKernelVersion(int *major, int *minor, int *patchlevel)
+-{
+- *major = version_major;
+- *minor = version_minor;
+- *patchlevel = version_patchlevel;
+-}
+-
+-/* ================================================== */
+-
+ #ifdef FEAT_LINUXCAPS
+ void
+ SYS_Linux_DropRoot(char *user)
+diff --git a/sys_linux.h b/sys_linux.h
+index 0df1cb1..46caf35 100644
+--- a/sys_linux.h
++++ b/sys_linux.h
+@@ -31,8 +31,6 @@ extern void SYS_Linux_Initialise(void);
+
+ extern void SYS_Linux_Finalise(void);
+
+-extern void SYS_Linux_GetKernelVersion(int *major, int *minor, int *patchlevel);
+-
+ extern void SYS_Linux_DropRoot(char *user);
+
+ extern void SYS_Linux_MemLockAll(int LockAll);
diff --git a/chrony.spec b/chrony.spec
index d9368c1..270d068 100644
--- a/chrony.spec
+++ b/chrony.spec
@@ -19,6 +19,8 @@ Source8: chrony.dhclient
%{?gitpatch:Patch0: chrony-%{version}-%{gitpatch}.patch.gz}
Patch1: chrony-cve-2012-4502.patch
Patch2: chrony-cve-2012-4503.patch
+# Support recent kernels
+Patch3: chrony-kernel.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: libcap-devel libedit-devel bison texinfo
@@ -41,6 +43,7 @@ mkdir pps; cp -p %{SOURCE6} pps
%{?gitpatch:%patch0 -p1}
%patch1 -p1 -b .cve-2012-4502
%patch2 -p1 -b .cve-2012-4503
+%patch3 -p1 -b .kernel
%{?gitpatch: echo %{version}-%{gitpatch} > version.txt}
More information about the scm-commits
mailing list