update to 4.3 (RHEL-54718)

Resolves: RHEL-54718
This commit is contained in:
Miroslav Lichvar 2024-06-10 12:04:39 +02:00
parent 1efe03e88a
commit f0446b151f
5 changed files with 15 additions and 117 deletions

6
.gitignore vendored
View File

@ -1,3 +1,3 @@
/linuxptp-4.2.tgz /linuxptp-4.3.tgz
/linuxptp-testsuite-bf8ead.tar.gz /linuxptp-testsuite-d27dbd.tar.gz
/clknetsim-5d1dc0.tar.gz /clknetsim-633a0b.tar.gz

View File

@ -1,75 +0,0 @@
commit bbfaa1e253b889aeea97702bbbc87e731e0caf87
Author: Miroslav Lichvar <mlichvar@redhat.com>
Date: Thu Feb 22 13:51:59 2024 +0100
lstab: Limit number of parsed leap seconds.
The lstab structure has a fixed-size array for leap seconds
(currently 28 + 200). Don't read more leap seconds from the leapfile to
avoid corrupting memory.
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
diff --git a/lstab.c b/lstab.c
index 24add26..8e35504 100644
--- a/lstab.c
+++ b/lstab.c
@@ -137,7 +137,7 @@ static int lstab_read(struct lstab *lstab, const char *name)
fprintf(stderr, "failed to open '%s' for reading: %m\n", name);
return -1;
}
- while (1) {
+ while (index < N_LEAPS) {
if (!fgets(buf, sizeof(buf), fp)) {
break;
}
commit 90ad2efc74b0f348fb6b417565b3ada7d161641b
Author: Miroslav Lichvar <mlichvar@redhat.com>
Date: Thu Feb 22 13:56:53 2024 +0100
lstab: Don't free lstab on update.
The modification timestamp of the leapfile is checked with every
call of lstab_utc2tai(). If the file is modified, the provided lstab
structure is freed and a new one is allocated from the updated leapfile.
But the new lstab is not returned to the caller as the function doesn't
accept a pointer to the pointer to lstab. This causes reading from the
freed memory and leak of the newly allocated memory.
Modify update_leapsecond_table() to read the updated leapfile into the
existing lstab structure instead of the reallocation.
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
diff --git a/lstab.c b/lstab.c
index 8e35504..357ed27 100644
--- a/lstab.c
+++ b/lstab.c
@@ -195,7 +195,6 @@ struct lstab *lstab_create(const char *filename)
int update_leapsecond_table(struct lstab *lstab)
{
- const char* leapfile;
struct stat statbuf;
int err;
@@ -212,14 +211,14 @@ int update_leapsecond_table(struct lstab *lstab)
return 0;
}
printf("updating leap seconds file\n");
- leapfile = lstab->leapfile;
- lstab_destroy(lstab);
- lstab = lstab_create(leapfile);
- if (!lstab) {
+ if (lstab_read(lstab, lstab->leapfile)) {
+ lstab->length = 0;
return -1;
}
+ lstab->lsfile_mtime = statbuf.st_mtim.tv_sec;
+
return 0;
}

View File

@ -1,26 +0,0 @@
commit b421a4c66ce636adff150dd1aa8eafa981c2693d
Author: Miroslav Lichvar <mlichvar@redhat.com>
Date: Wed Jan 3 14:45:51 2024 +0100
pmc: Allow missing values in SUBSCRIBE_EVENTS_NP command.
Don't require all supported notifications to be specified in the command
for compatibility with older scripts.
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
diff --git a/pmc_common.c b/pmc_common.c
index 62e34a6..b88cfc2 100644
--- a/pmc_common.c
+++ b/pmc_common.c
@@ -310,8 +310,8 @@ static void do_set_action(struct pmc *pmc, int action, int index, char *str)
onoff_port_state,
onoff_time_status,
onoff_parent_data_set);
- if (cnt != 4) {
- fprintf(stderr, "%s SET needs 4 values\n",
+ if (cnt < 2) {
+ fprintf(stderr, "%s SET needs at least 2 values\n",
idtab[index].name);
break;
}

View File

@ -1,18 +1,18 @@
%global _hardened_build 1 %global _hardened_build 1
%global testsuite_ver bf8ead %global testsuite_ver d27dbd
%global clknetsim_ver 5d1dc0 %global clknetsim_ver 633a0b
%global selinuxtype targeted %global selinuxtype targeted
%bcond_without selinux %bcond_without selinux
Name: linuxptp Name: linuxptp
Version: 4.2 Version: 4.3
Release: 7%{?dist} Release: 7%{?dist}
Summary: PTP implementation for Linux Summary: PTP implementation for Linux
License: GPL-2.0-or-later License: GPL-2.0-or-later
URL: https://linuxptp.sourceforge.net/ URL: https://www.linuxptp.org/
Source0: https://downloads.sourceforge.net/%{name}/%{name}-%{version}.tgz Source0: https://downloads.nwtime.org/%{name}/%{name}-%{version}.tgz
Source1: phc2sys.service Source1: phc2sys.service
Source2: ptp4l.service Source2: ptp4l.service
Source3: timemaster.service Source3: timemaster.service
@ -29,14 +29,10 @@ Source22: linuxptp.te
# limit unicast message rate per address and grant duration # limit unicast message rate per address and grant duration
Patch1: linuxptp-ucastrate.patch Patch1: linuxptp-ucastrate.patch
# allow old syntax of SET SUBSCRIBE_EVENTS_NP command
Patch2: linuxptp-subscribe.patch
# fix loading and reloading of leapfile
Patch3: linuxptp-lstab.patch
# fix ts2phc to handle large NMEA delay # fix ts2phc to handle large NMEA delay
Patch4: linuxptp-nmeadelay.patch Patch4: linuxptp-nmeadelay.patch
BuildRequires: gcc gcc-c++ make systemd BuildRequires: gcc gcc-c++ gnutls-devel make systemd
%{?systemd_requires} %{?systemd_requires}
@ -72,6 +68,9 @@ linuxptp SELinux policy module
%__rpmuncompress -x %{SOURCE11} %__rpmuncompress -x %{SOURCE11}
%autopatch -p1 %autopatch -p1
# disable nettle support in favor of gnutls
sed -i 's|find .*"nettle"|true|' incdefs.sh
mv linuxptp-testsuite-%{testsuite_ver}* testsuite mv linuxptp-testsuite-%{testsuite_ver}* testsuite
mv clknetsim-%{clknetsim_ver}* testsuite/clknetsim mv clknetsim-%{clknetsim_ver}* testsuite/clknetsim

View File

@ -1,3 +1,3 @@
SHA512 (linuxptp-4.2.tgz) = 479e512efd0573602379a9e1d8ef5c0ec9e033944cee5aed11c68cea5e8a3f7d4b6f2d11f6d6d4718282010da52c2c8629d675d9b388cc0c3d574845a913cdbb SHA512 (linuxptp-4.3.tgz) = 1cd5a65f53080ddbe01a1125cbf21c20cebed06f727e76a7d1cddee2514c229a7efd9b465bad839ffd923d0679da84316936368b3740d64c085d9f09e5b683df
SHA512 (linuxptp-testsuite-bf8ead.tar.gz) = 6a6d190e8ef43cdb91304f9dc69fd4bc71590b2178c10a8305ddc2660fdc0963a00721db46b951afb0aaf73b268ce2927bca6551010477b6e59ce64aeec22bc6 SHA512 (linuxptp-testsuite-d27dbd.tar.gz) = e289f63d522eaac3deb1db81442805fb602ae5423c02afb2200e59518e9c3db8dcaa00e42a57f0d81d51bb2e7cbd4b82c1d3522abbb5e5569cfd795ba403d659
SHA512 (clknetsim-5d1dc0.tar.gz) = 76889da425dc9d63ba78811661d78ffa922a63c4f83aeb809fef02c866f64a97b09dd4b0906ccfd1e20cee5091d8b886aadfce54cd338d3bf597b0e976a78927 SHA512 (clknetsim-633a0b.tar.gz) = e58ff5914074f6c9333692fd078e6d70a65c9af32b9f67e8993ea8eeb8910083e91fb29ce4fc68134380e53c0b73a892cda989f87bc7d3f1b9a4d3e6a455be55