Compare commits

..

No commits in common. "c10-beta" and "c8s" have entirely different histories.

8 changed files with 89 additions and 197 deletions

3
.gitignore vendored
View File

@ -1 +1,2 @@
ipset-7.21.tar.bz2 SOURCES/ipset-7.1.tar.bz2
/ipset-7.1.tar.bz2

View File

@ -1,39 +0,0 @@
From 90f9e82d1db7f81c8d1e41de9fadb82d51c9a2d0 Mon Sep 17 00:00:00 2001
From: Phil Sutter <phil@nwl.cc>
Date: Thu, 27 Jun 2024 10:18:17 +0200
Subject: [PATCH] lib: ipset: Avoid 'argv' array overstepping
The maximum accepted value for 'argc' is MAX_ARGS which matches 'argv'
array size. The maximum allowed array index is therefore argc-1.
This fix will leave items in argv non-NULL-terminated, so explicitly
NULL the formerly last entry after shifting.
Looks like a day-1 bug. Interestingly, this neither triggered ASAN nor
valgrind. Yet adding debug output printing argv entries being copied
did.
Fixes: 1e6e8bd9a62aa ("Third stage to ipset-5")
Signed-off-by: Phil Sutter <phil@nwl.cc>
Signed-off-by: Jozsef Kadlecsik <kadlec@netfilter.org>
(cherry picked from commit 851cb04ffee5040f1e0063f77c3fe9bc6245e0fb)
---
lib/ipset.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/ipset.c b/lib/ipset.c
index c910d88805c28..3bf1c5fcdbc59 100644
--- a/lib/ipset.c
+++ b/lib/ipset.c
@@ -343,9 +343,9 @@ ipset_shift_argv(int *argc, char *argv[], int from)
assert(*argc >= from + 1);
- for (i = from + 1; i <= *argc; i++)
+ for (i = from + 1; i < *argc; i++)
argv[i-1] = argv[i];
- (*argc)--;
+ argv[--(*argc)] = NULL;
return;
}

7
gating.yaml Normal file
View File

@ -0,0 +1,7 @@
--- !Policy
product_versions:
- rhel-8
decision_context: osci_compose_gate
rules:
# - !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional}
- !PassingTestCaseRule {test_case_name: baseos-ci.brew-build.tier1-gating.functional}

View File

@ -1,5 +1,5 @@
# Save current ipsets on stop. # Save current ipsets on stop.
# Value: yes|no, default: no # Value: yes|no, default: no
# Saves all ipsets to /etc/sysconfig/ipset.d/ if service gets stopped # Saves all ipsets to /etc/ipset/ipset if service gets stopped
# (e.g. on system shutdown). # (e.g. on system shutdown).
IPSET_SAVE_ON_STOP="no" IPSET_SAVE_ON_STOP="no"

2
ipset.save-legacy Normal file
View File

@ -0,0 +1,2 @@
#!/bin/bash
exec /usr/libexec/ipset/ipset.start-stop save

View File

@ -1,23 +1,20 @@
# service legacy actions
%define legacy_actions %{_libexecdir}/initscripts/legacy-actions
Name: ipset Name: ipset
Version: 7.21 Version: 7.1
Release: 3%{?dist} Release: 1%{?dist}
Summary: Manage Linux IP sets Summary: Manage Linux IP sets
License: GPL-2.0-only License: GPLv2
URL: http://ipset.netfilter.org/ URL: http://ipset.netfilter.org/
Source0: %{url}/%{name}-%{version}.tar.bz2 Source0: http://ipset.netfilter.org/%{name}-%{version}.tar.bz2
Source1: %{name}.service Source1: %{name}.service
Source2: %{name}.start-stop Source2: %{name}.start-stop
Source3: %{name}-config Source3: %{name}-config
Source4: %{name}.save-legacy
Patch0001: 0001-lib-ipset-Avoid-argv-array-overstepping.patch
BuildRequires: libmnl-devel BuildRequires: libmnl-devel
BuildRequires: automake
BuildRequires: autoconf
BuildRequires: make
BuildRequires: libtool
BuildRequires: libtool-ltdl-devel
# An explicit requirement is needed here, to avoid cases where a user would # An explicit requirement is needed here, to avoid cases where a user would
# explicitly update only one of the two (e.g 'yum update ipset') # explicitly update only one of the two (e.g 'yum update ipset')
@ -50,7 +47,6 @@ This package contains the libraries which provide the IP sets funcionality.
%package devel %package devel
Summary: Development files for %{name} Summary: Development files for %{name}
Requires: %{name}-libs%{?_isa} == %{version}-%{release} Requires: %{name}-libs%{?_isa} == %{version}-%{release}
Requires: kernel-headers
%description devel %description devel
This package contains the files required to develop software using the %{name} This package contains the files required to develop software using the %{name}
@ -73,11 +69,10 @@ out of the base package since it is not active by default.
%prep %prep
%autosetup -p1 %setup -q
%build %build
./autogen.sh
%configure --enable-static=no --with-kmod=no %configure --enable-static=no --with-kmod=no
# Just to make absolutely sure we are not building the bundled kernel module # Just to make absolutely sure we are not building the bundled kernel module
@ -88,11 +83,11 @@ rm -fr kernel
sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool
sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool
%make_build make %{?_smp_mflags}
%install %install
%make_install make install DESTDIR=%{buildroot}
find %{buildroot} -name '*.la' -exec rm -f '{}' \; find %{buildroot} -name '*.la' -exec rm -f '{}' \;
# install systemd unit file # install systemd unit file
@ -107,6 +102,10 @@ install -c -m 755 %{SOURCE2} %{buildroot}%{_libexecdir}/%{name}
install -d -m 755 %{buildroot}%{_sysconfdir}/sysconfig install -d -m 755 %{buildroot}%{_sysconfdir}/sysconfig
install -c -m 600 %{SOURCE3} %{buildroot}%{_sysconfdir}/sysconfig/%{name}-config install -c -m 600 %{SOURCE3} %{buildroot}%{_sysconfdir}/sysconfig/%{name}-config
# install legacy actions for service command
install -d %{buildroot}/%{legacy_actions}/ipset
install -c -m 755 %{SOURCE4} %{buildroot}/%{legacy_actions}/ipset/save
# Create directory for configuration # Create directory for configuration
mkdir -p %{buildroot}%{_sysconfdir}/%{name} mkdir -p %{buildroot}%{_sysconfdir}/%{name}
@ -118,23 +117,13 @@ if [[ $1 -eq 0 && -n $(lsmod | grep "^xt_set ") ]]; then
fi fi
%ldconfig_scriptlets libs %post libs -p /sbin/ldconfig
%postun libs -p /sbin/ldconfig
%post service %post service
%systemd_post %{name}.service %systemd_post %{name}.service
if [[ -f /etc/ipset/ipset ]] && [[ ! -f /etc/sysconfig/ipset ]]; then
mv /etc/ipset/ipset /etc/sysconfig/ipset
ln -s /etc/sysconfig/ipset /etc/ipset/ipset
echo "Warning: ipset save location has moved to /etc/sysconfig"
fi
[[ -f /etc/sysconfig/iptables-config ]] && . /etc/sysconfig/iptables-config
[[ -f /etc/sysconfig/ip6tables-config ]] && . /etc/sysconfig/ip6tables-config
if [[ ${IPTABLES_SAVE_ON_STOP} == yes ]] || \
[[ ${IP6TABLES_SAVE_ON_STOP} == yes ]]; then
echo "Warning: ipset no longer saves automatically when iptables does"
echo " must enable explicitly in /etc/sysconfig/ipset-config"
fi
%preun service %preun service
if [[ $1 -eq 0 && -n $(lsmod | grep "^xt_set ") ]]; then if [[ $1 -eq 0 && -n $(lsmod | grep "^xt_set ") ]]; then
@ -146,23 +135,35 @@ fi
%postun service %postun service
%systemd_postun_with_restart %{name}.service %systemd_postun_with_restart %{name}.service
%triggerin service -- ipset-service < 6.38-1.el7
# Before 6.38-1, ipset.start-stop keeps a backup of previously saved sets, but
# doesn't touch the /etc/sysconfig/ipset.d/.saved flag. Remove the backup on
# upgrade, so that we use the current version of saved sets
rm -f /etc/sysconfig/ipset.save || :
exit 0
%triggerun service -- ipset-service < 6.38-1.el7
# Up to 6.29-1, ipset.start-stop uses a single data file
for f in /etc/sysconfig/ipset.d/*; do
[ "${f}" = "/etc/sysconfig/ipset.d/*" ] && break
cat ${f} >> /etc/sysconfig/ipset || :
done
exit 0
%files %files
%doc ChangeLog %doc COPYING ChangeLog
%license COPYING %doc %{_mandir}/man8/%{name}.8.gz
%{_mandir}/man8/%{name}*.8.*
%{_sbindir}/%{name} %{_sbindir}/%{name}
%{_sbindir}/%{name}-translate
%files libs %files libs
%license COPYING %doc COPYING
%{_libdir}/lib%{name}.so.13* %{_libdir}/lib%{name}.so.13*
%doc %{_mandir}/man3/lib%{name}.3.gz
%files devel %files devel
%{_includedir}/lib%{name} %{_includedir}/lib%{name}
%{_libdir}/lib%{name}.so %{_libdir}/lib%{name}.so
%{_libdir}/pkgconfig/lib%{name}.pc %{_libdir}/pkgconfig/lib%{name}.pc
%{_mandir}/man3/libipset.3.*
%files service %files service
%{_unitdir}/%{name}.service %{_unitdir}/%{name}.service
@ -170,125 +171,51 @@ fi
%config(noreplace) %attr(0600,root,root) %{_sysconfdir}/sysconfig/ipset-config %config(noreplace) %attr(0600,root,root) %{_sysconfdir}/sysconfig/ipset-config
%ghost %config(noreplace) %attr(0600,root,root) %{_sysconfdir}/sysconfig/ipset %ghost %config(noreplace) %attr(0600,root,root) %{_sysconfdir}/sysconfig/ipset
%attr(0755,root,root) %{_libexecdir}/%{name}/%{name}.start-stop %attr(0755,root,root) %{_libexecdir}/%{name}/%{name}.start-stop
%dir %{legacy_actions}/ipset
%{legacy_actions}/ipset/save
%changelog %changelog
* Wed Sep 11 2024 Phil Sutter <psutter@redhat.com> - 7.21-3 * Sun May 26 2019 Stefano Brivio <sbrivio@redhat.com> - 7.1-1
- lib: ipset: Avoid 'argv' array overstepping - Rebase to 7.1 (RHBZ#1649090):
- Add compatibility support for strscpy()
- Correct the manpage about the sort option
- Add missing functions to libipset.map
- configure.ac: Fix build regression on RHEL/CentOS/SL (Serhey Popovych)
- Implement sorting for hash types in the ipset tool
- Fix to list/save into file specified by option (reported by Isaac Good)
- Introduction of new commands and protocol version 7, updated kernel include files
- Add compatibility support for async in pernet_operations
- Use more robust awk patterns to check for backward compatibility
- Prepare the ipset tool to handle multiple protocol version
- Fix warning message handlin
- Correct to test null valued entry in hash:net6,port,net6 test
- Library reworked to support embedding ipset completely
- Add compatibility to support kvcalloc()
- Validate string type attributes in attr2data() (Stefano Brivio)
- manpage: Add comment about matching on destination MAC address (Stefano Brivio)
(RHBZ#1649079)
- Add compatibility to support is_zero_ether_addr()
- Fix use-after-free in ipset_parse_name_compat() (Stefano Brivio) (RHBZ#1649085)
- Fix leak in build_argv() on line parsing error (Stefano Brivio) (RHBZ#1649085)
- Simplify return statement in ipset_mnl_query() (Stefano Brivio) (RHBZ#1649085)
- tests/check_klog.sh: Try dmesg too, don't let shell terminate script (Stefano Brivio)
- Fixes:
- Fix all shellcheck warnings in init script (RHBZ#1649085)
- Make error reporting consistent, introduce different severities (RHBZ#1683711)
- While restoring, on invalid entries, remove them and retry (RHBZ#1683713)
- Fix covscan SC2166 warning in init script (RHBZ#1649085)
* Mon Jun 24 2024 Troy Dawson <tdawson@redhat.com> - 7.21-2 * Tue Nov 13 2018 Stefano Brivio <sbrivio@redhat.com> - 6.38-3
- Bump release for June 2024 mass rebuild - Fix loading of sets with dependencies on other sets (RHBZ#1647096), and
hardcode 6.38-1.el7 for ipset-service upgrade and downgrade triggers, so that
we don't run into issues with z-stream updates
* Mon Feb 12 2024 Nicolas Chauvet <kwizart@gmail.com> - 7.21-1 * Mon Oct 08 2018 Stefano Brivio <sbrivio@redhat.com> - 6.38-2
- Update to 7.21 - Drop ipset-devel dependency on kernel-devel (RHBZ#163175)
* Thu Feb 01 2024 Nicolas Chauvet <kwizart@gmail.com> - 7.20-1 * Tue Aug 14 2018 Stefano Brivio <sbrivio@redhat.com> - 6.38-1
- Update to 7.20 - Update to 6.38, source from RHEL7 6.38-2 (RHBZ#1615967)
* Wed Jan 24 2024 Fedora Release Engineering <releng@fedoraproject.org> - 7.19-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
* Sat Jan 20 2024 Fedora Release Engineering <releng@fedoraproject.org> - 7.19-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
* Mon Oct 23 2023 Nicolas Chauvet <kwizart@gmail.com> - 7.19-1
- Update to 7.19
* Fri Aug 11 2023 Phil Sutter <psutter@redhat.com> - 7.17-7
- Convert license to SPDX format
* Fri Aug 11 2023 Phil Sutter <psutter@redhat.com> - 7.17-6
- Convert license to SPDX format
* Fri Aug 11 2023 Phil Sutter <psutter@redhat.com> - 7.17-5
- Convert license to SPDX format
* Fri Aug 11 2023 Phil Sutter <psutter@redhat.com> - 7.17-4
- Convert license to SPDX format
* Thu Jul 20 2023 Fedora Release Engineering <releng@fedoraproject.org> - 7.17-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
* Thu Jan 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 7.17-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
* Mon Jan 02 2023 Nicolas Chauvet <kwizart@gmail.com> - 7.17-1
- Update to 7.17
* Fri Dec 02 2022 Nicolas Chauvet <kwizart@gmail.com> - 7.16-1
- Update to 7.16
* Tue Aug 23 2022 Nicolas Chauvet <kwizart@gmail.com> - 7.15-5
- Backport upstream patches - rhbz#2117654
ipset-translate does not work with IPv6 sets
* Thu Jul 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 7.15-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
* Tue Mar 15 2022 Phil Sutter <psutter@redhat.com> - 7.15-3
- Use the advanced init script from Centos9Stream
* Thu Jan 20 2022 Fedora Release Engineering <releng@fedoraproject.org> - 7.15-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
* Mon Aug 16 2021 Nicolas Chauvet <kwizart@gmail.com> - 7.15-1
- Update to 7.15
* Wed Jul 28 2021 Nicolas Chauvet <kwizart@gmail.com> - 7.14-1
- Update to 7.14
* Thu Jul 22 2021 Fedora Release Engineering <releng@fedoraproject.org> - 7.11-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
* Tue Mar 02 2021 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 7.11-2
- Rebuilt for updated systemd-rpm-macros
See https://pagure.io/fesco/issue/2583.
* Mon Mar 01 2021 Nicolas Chauvet <kwizart@gmail.com> - 7.11-1
- Update to 7.11
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 7.10-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Mon Dec 21 2020 Nicolas Chauvet <kwizart@gmail.com> - 7.10-1
- Update to 7.10
* Wed Dec 16 2020 Nicolas Chauvet <kwizart@gmail.com> - 7.9-1
- Update to 7.9
* Tue Jul 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 7.6-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Mon Feb 24 2020 Nicolas Chauvet <kwizart@gmail.com> - 7.6-1
- Update to 7.6
* Wed Jan 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 7.5-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
* Fri Jan 10 2020 Nicolas Chauvet <kwizart@gmail.com> - 7.5-1
- Update to 7.5
* Mon Nov 04 2019 Eric Garver <eric@garver.life> - 7.4-1
- Update to 7.4
* Mon Aug 19 2019 Nicolas Chauvet <kwizart@gmail.com> - 7.3-1
- Update to 7.3
* Thu Jul 25 2019 Fedora Release Engineering <releng@fedoraproject.org> - 7.2-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Thu Jul 11 2019 Nicolas Chauvet <kwizart@gmail.com> - 7.2-1
- Update to 7.2
* Fri Feb 01 2019 Fedora Release Engineering <releng@fedoraproject.org> - 6.38-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
* Mon Aug 13 2018 Nicolas Chauvet <kwizart@gmail.com> - 6.38-1
- Update to 6.38
- Clean-up spec
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 6.35-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
* Mon Feb 12 2018 Eric Garver <egarver@redhat.com> - 6.35-3 * Mon Feb 12 2018 Eric Garver <egarver@redhat.com> - 6.35-3
- Patch for missing header file (RHBZ#1543596) - Patch for missing header file (RHBZ#1543596)

View File

@ -257,13 +257,7 @@ load() {
CLEAN_FILES="${CLEAN_FILES} ${mangled}" CLEAN_FILES="${CLEAN_FILES} ${mangled}"
chmod 600 "${mangled}" chmod 600 "${mangled}"
cat "${merged}" > "${mangled}" awk '/^(add|create) ('"${conflicts}"')/ { printf "%s ",$1; system("echo '${salt}'" $2 " | md5sum | head -c31"); $1=""; $2=""; print; next} {print}' "${merged}" > "${mangled}"
IFS='|'
for set in ${conflicts}; do
new_name=$(echo "${salt}${set}" | md5sum | head -c31)
echo "s/^(add|create) $set /\1 $new_name /"
done | sed -i -r -f - "${mangled}"
unset IFS
if ! ipset_restore "${mangled}"; then if ! ipset_restore "${mangled}"; then
err "Failed to restore configured sets" err "Failed to restore configured sets"
exit 1 exit 1

View File

@ -1 +1 @@
SHA512 (ipset-7.21.tar.bz2) = 175c6516c2091c57738a0324678d8d016e4d7f18fa03cb0dcc502391cac4caf4db1e757f61ad2fe312c1dbe431ec9cfabbc8e15a64a94ebd2fa903155b27c88f SHA512 (ipset-7.1.tar.bz2) = eae9bd83f6675754af8ca443a82e0a1c9d47f60f6bf2a7a405a695223cc17063d5d4eb79428fe21a1f0a867109dfaf8ad8071b45e92191ec108b2cd2382fa854