update to 3.3-pre1

This commit is contained in:
Miroslav Lichvar 2018-03-15 09:28:24 +01:00
parent e690bd94d1
commit c1f119f1f1
4 changed files with 8 additions and 104 deletions

4
.gitignore vendored
View File

@ -1,2 +1,2 @@
/chrony-3.2.tar.gz
/clknetsim-71dbbc.tar.gz
/chrony-3.3-pre1.tar.gz
/clknetsim-5b4d14.tar.gz

View File

@ -1,94 +0,0 @@
commit d0b24860363a3704e28569ce9a6987717834edea
Author: Miroslav Lichvar <mlichvar@redhat.com>
Date: Tue Dec 5 11:08:24 2017 +0100
client: don't call select() with invalid timeout
If the system clock was stepped forward after chronyc sent a request and
before it read the clock in order to calculate the receive timeout,
select() could be called with a negative timeout, which resulted in an
infinite loop waiting for select() to succeed.
Fix the submit_request() function to not call select() with a negative
timeout. Also, return immediately on any error of select().
diff --git a/client.c b/client.c
index 5c3a99e..4e23158 100644
--- a/client.c
+++ b/client.c
@@ -1394,9 +1394,16 @@ submit_request(CMD_Request *request, CMD_Reply *reply)
timeout = initial_timeout / 1000.0 * (1U << (n_attempts - 1)) -
UTI_DiffTimespecsToDouble(&ts_now, &ts_start);
- UTI_DoubleToTimeval(timeout, &tv);
DEBUG_LOG("Timeout %f seconds", timeout);
+ /* Avoid calling select() with an invalid timeout */
+ if (timeout <= 0.0) {
+ new_attempt = 1;
+ continue;
+ }
+
+ UTI_DoubleToTimeval(timeout, &tv);
+
FD_ZERO(&rdfd);
FD_ZERO(&wrfd);
FD_ZERO(&exfd);
@@ -1410,6 +1417,7 @@ submit_request(CMD_Request *request, CMD_Reply *reply)
if (select_status < 0) {
DEBUG_LOG("select failed : %s", strerror(errno));
+ return 0;
} else if (select_status == 0) {
/* Timeout must have elapsed, try a resend? */
new_attempt = 1;
commit 6863e43269fe27ce2744eb643295f31c00ec176d
Author: Miroslav Lichvar <mlichvar@redhat.com>
Date: Tue Dec 12 11:03:04 2017 +0100
client: avoid reading clock after sending request
If chronyc sent a request which caused chronyd to step the clock (e.g.
makestep, settime) and the second reading of the clock before calling
select() to wait for a response happened after the clock was stepped, a
new request could be sent immediately and chronyd would process the same
command twice. If the second request failed (e.g. a settime request too
close to the first request), chronyc would report an error.
Change the submit_request() function to read the clock only once per
select() to wait for the first response even when the clock was stepped.
diff --git a/client.c b/client.c
index a04dcb8..7d1e346 100644
--- a/client.c
+++ b/client.c
@@ -1347,15 +1347,15 @@ submit_request(CMD_Request *request, CMD_Reply *reply)
new_attempt = 1;
do {
+ if (gettimeofday(&tv, NULL))
+ return 0;
+
if (new_attempt) {
new_attempt = 0;
if (n_attempts > max_retries)
return 0;
- if (gettimeofday(&tv, NULL))
- return 0;
-
UTI_TimevalToTimespec(&tv, &ts_start);
UTI_GetRandomBytes(&request->sequence, sizeof (request->sequence));
@@ -1383,9 +1383,6 @@ submit_request(CMD_Request *request, CMD_Reply *reply)
DEBUG_LOG("Sent %d bytes", command_length);
}
- if (gettimeofday(&tv, NULL))
- return 0;
-
UTI_TimevalToTimespec(&tv, &ts_now);
/* Check if the clock wasn't stepped back */

View File

@ -1,9 +1,10 @@
%global _hardened_build 1
%global clknetsim_ver 71dbbc
%global prerelease -pre1
%global clknetsim_ver 5b4d14
%bcond_without debug
Name: chrony
Version: 3.2
Version: 3.3
Release: 4%{?dist}
Summary: An NTP client/server
@ -21,8 +22,6 @@ Source10: https://github.com/mlichvar/clknetsim/archive/%{clknetsim_ver}/c
# add NTP servers from DHCP when starting service
Patch1: chrony-service-helper.patch
# fix chronyc getting stuck in infinite loop after clock step
Patch2: chrony-select-timeout.patch
BuildRequires: libcap-devel libedit-devel nss-devel pps-tools-devel
%ifarch %{ix86} x86_64 %{arm} aarch64 mipsel mips64el ppc64 ppc64le s390 s390x
@ -54,7 +53,6 @@ service to other computers in the network.
%setup -q -n %{name}-%{version}%{?prerelease} -a 10
%{?gitpatch:%patch0 -p1}
%patch1 -p1 -b .service-helper
%patch2 -p1 -b .select-timeout
%{?gitpatch: echo %{version}-%{gitpatch} > version.txt}
@ -64,7 +62,7 @@ md5sum -c <<-EOF | (! grep -v 'OK$')
e473a9fab7fe200cacce3dca8b66290b examples/chrony.conf.example2
ba6bb05c50e03f6b5ab54a2b7914800d examples/chrony.keys.example
6a3178c4670de7de393d9365e2793740 examples/chrony.logrotate
27cbc940c94575de320dbd251cbb4514 examples/chrony.nm-dispatcher
63e0781f84e89ba6029d93ef0722c4ce examples/chrony.nm-dispatcher
a85246982a89910b1e2d3356b7d131d7 examples/chronyd.service
EOF

View File

@ -1,2 +1,2 @@
SHA512 (chrony-3.2.tar.gz) = 496af5bed91600f268c1a0fa577bb8c7785e485f78598b666829c674e94770c16548cec4289a2ae9d0a51191d2705eda00886cb6cccae3828aa201a49d4783a4
SHA512 (clknetsim-71dbbc.tar.gz) = 626175a3e97b33eaa462cd8416d5da18f44750d74a73dc824b591573a30613e956275951fd9d5bc52e1092284b0d7a67a85179e89532fa41d4a74c97aa0c78ba
SHA512 (chrony-3.3-pre1.tar.gz) = 39bb4788d362d9aaf30b84c59eaf3421110c3776d57eb955f12d8fdd6013f8ffa91a6ff1e8b0018113f63d660570b1aa70d96f7c31faca29d5b720c2f3f1d625
SHA512 (clknetsim-5b4d14.tar.gz) = 6fc12fec423af00bb7329ee903e49021d38285e891cdb855e2c48ebf335d4142cc742acce85f37a51f97ed33643ff54d9da9a1adf6365b8e5a719a409334020c