diff --git a/0007-ospfd-crash.patch b/0007-ospfd-crash.patch new file mode 100644 index 0000000..2eceab9 --- /dev/null +++ b/0007-ospfd-crash.patch @@ -0,0 +1,108 @@ +From 4f08c715db6893ff439d0a39bf4506cd26256d13 Mon Sep 17 00:00:00 2001 +From: Igor Ryzhov +Date: Fri, 18 Jun 2021 13:06:13 +0300 +Subject: [PATCH] lib: remove pure attribute from functions that modify memory + +Almost all functions currently marked with pure attribute acquire a +route_node lock. By marking them pure we allow compiler to optimize the +code and not call them when it already knows the return value. This is +completely incorrect. + +Only two of eleven functions can be marked as pure. And they still won't +be optimized because they are never called from the same function twice. +Let's remove the ext_pure macro completely to reduce the chance of +repeating this mistake in the future. + +Fixes #8866, #8809, #8595, #6992. + +Signed-off-by: Igor Ryzhov +--- + lib/compiler.h | 9 --------- + lib/table.h | 44 ++++++++++++++++++++------------------------ + 2 files changed, 20 insertions(+), 33 deletions(-) + +diff --git a/lib/compiler.h b/lib/compiler.h +index bbfe01b569c..e805eb8be48 100644 +--- a/lib/compiler.h ++++ b/lib/compiler.h +@@ -123,15 +123,6 @@ extern "C" { + #define assume(x) + #endif + +-/* pure = function does not modify memory & return value is the same if +- * memory hasn't changed (=> allows compiler to optimize) +- * +- * Mostly autodetected by the compiler if function body is available (i.e. +- * static inline functions in headers). Since that implies it should only be +- * used in headers for non-inline functions, the "extern" is included here. +- */ +-#define ext_pure extern __attribute__((pure)) +- + /* for helper functions defined inside macros */ + #define macro_inline static inline __attribute__((unused)) + #define macro_pure static inline __attribute__((unused, pure)) +diff --git a/lib/table.h b/lib/table.h +index 7e383dce808..5dec69ee7ea 100644 +--- a/lib/table.h ++++ b/lib/table.h +@@ -197,29 +197,25 @@ static inline void route_table_set_info(struct route_table *table, void *d) + table->info = d; + } + +-/* ext_pure => extern __attribute__((pure)) +- * does not modify memory (but depends on mem), allows compiler to optimize +- */ +- + extern void route_table_finish(struct route_table *table); +-ext_pure struct route_node *route_top(struct route_table *table); +-ext_pure struct route_node *route_next(struct route_node *node); +-ext_pure struct route_node *route_next_until(struct route_node *node, +- const struct route_node *limit); ++extern struct route_node *route_top(struct route_table *table); ++extern struct route_node *route_next(struct route_node *node); ++extern struct route_node *route_next_until(struct route_node *node, ++ const struct route_node *limit); + extern struct route_node *route_node_get(struct route_table *table, + union prefixconstptr pu); +-ext_pure struct route_node *route_node_lookup(struct route_table *table, +- union prefixconstptr pu); +-ext_pure struct route_node *route_node_lookup_maynull(struct route_table *table, +- union prefixconstptr pu); +-ext_pure struct route_node *route_node_match(struct route_table *table, +- union prefixconstptr pu); +-ext_pure struct route_node *route_node_match_ipv4(struct route_table *table, +- const struct in_addr *addr); +-ext_pure struct route_node *route_node_match_ipv6(struct route_table *table, +- const struct in6_addr *addr); +- +-ext_pure unsigned long route_table_count(struct route_table *table); ++extern struct route_node *route_node_lookup(struct route_table *table, ++ union prefixconstptr pu); ++extern struct route_node *route_node_lookup_maynull(struct route_table *table, ++ union prefixconstptr pu); ++extern struct route_node *route_node_match(struct route_table *table, ++ union prefixconstptr pu); ++extern struct route_node *route_node_match_ipv4(struct route_table *table, ++ const struct in_addr *addr); ++extern struct route_node *route_node_match_ipv6(struct route_table *table, ++ const struct in6_addr *addr); ++ ++extern unsigned long route_table_count(struct route_table *table); + + extern struct route_node *route_node_create(route_table_delegate_t *delegate, + struct route_table *table); +@@ -228,10 +224,10 @@ extern void route_node_destroy(route_table_delegate_t *delegate, + struct route_table *table, + struct route_node *node); + +-ext_pure struct route_node *route_table_get_next(struct route_table *table, +- union prefixconstptr pu); +-ext_pure int route_table_prefix_iter_cmp(const struct prefix *p1, +- const struct prefix *p2); ++extern struct route_node *route_table_get_next(struct route_table *table, ++ union prefixconstptr pu); ++extern int route_table_prefix_iter_cmp(const struct prefix *p1, ++ const struct prefix *p2); + + /* + * Iterator functions. diff --git a/frr.spec b/frr.spec index 32d693e..80ecad2 100644 --- a/frr.spec +++ b/frr.spec @@ -1,34 +1,56 @@ %global frrversion 7.5.1 -%global frr_libdir /usr/libexec/frr +%global frr_libdir %{_libexecdir}/frr %global _hardened_build 1 %define _legacy_common_support 1 Name: frr Version: 7.5.1 -Release: 5%{?checkout}%{?dist} +Release: 6%{?checkout}%{?dist} Summary: Routing daemon License: GPLv2+ URL: http://www.frrouting.org Source0: https://github.com/FRRouting/frr/releases/download/%{name}-%{frrversion}/%{name}-%{frrversion}.tar.gz Source1: %{name}-tmpfiles.conf -BuildRequires: perl-generators -BuildRequires: gcc gcc-c++ -BuildRequires: net-snmp-devel -BuildRequires: texinfo libcap-devel autoconf automake libtool patch groff -BuildRequires: readline readline-devel ncurses ncurses-devel -BuildRequires: git pam-devel c-ares-devel -BuildRequires: json-c-devel bison >= 2.7 flex perl-XML-LibXML -BuildRequires: python3-devel python3-sphinx python3-pytest -BuildRequires: systemd systemd-devel -BuildRequires: libyang-devel >= 0.16.74 -BuildRequires: make -Requires: net-snmp ncurses -Requires(post): systemd /sbin/install-info hostname -Requires(preun): systemd /sbin/install-info +BuildRequires: autoconf +BuildRequires: automake +BuildRequires: bison >= 2.7 +BuildRequires: c-ares-devel +BuildRequires: flex +BuildRequires: gcc +BuildRequires: gcc-c++ +BuildRequires: git-core +BuildRequires: groff +BuildRequires: json-c-devel +BuildRequires: libcap-devel +BuildRequires: libtool +BuildRequires: libyang-devel >= 0.16.74 +BuildRequires: make +BuildRequires: ncurses +BuildRequires: ncurses-devel +BuildRequires: net-snmp-devel +BuildRequires: pam-devel +BuildRequires: patch +BuildRequires: perl-XML-LibXML +BuildRequires: perl-generators +BuildRequires: python3-devel +BuildRequires: python3-pytest +BuildRequires: python3-sphinx +BuildRequires: readline-devel +BuildRequires: systemd-devel +BuildRequires: systemd-rpm-macros +BuildRequires: texinfo + +Requires: net-snmp +Requires: ncurses +Requires(post): systemd +Requires(post): /sbin/install-info +Requires(post): hostname +Requires(preun): systemd +Requires(preun): /sbin/install-info Requires(postun): systemd -Provides: routingdaemon = %{version}-%{release} Conflicts: quagga +Provides: routingdaemon = %{version}-%{release} Patch0000: 0000-remove-babeld-and-ldpd.patch Patch0001: 0001-use-python3.patch @@ -37,6 +59,7 @@ Patch0003: 0003-disable-eigrp-crypto.patch Patch0004: 0004-fips-mode.patch Patch0005: 0005-icc-options.patch Patch0006: 0006-move-to-libexec.patch +Patch0007: 0007-ospfd-crash.patch %description FRRouting is free software that manages TCP/IP based routing protocols. It takes @@ -107,8 +130,8 @@ install -p -m 644 %{_builddir}/%{name}-%{frrversion}/redhat/frr.logrotate %{buil install -p -m 644 %{_builddir}/%{name}-%{frrversion}/redhat/frr.pam %{buildroot}/etc/pam.d/frr install -d -m 775 %{buildroot}/run/frr -rm %{buildroot}%{_libdir}/frr/*.la -rm %{buildroot}%{_libdir}/frr/modules/*.la +# Delete libtool archives +find %{buildroot} -type f -name "*.la" -delete -print #Upstream does not maintain a stable API, these headers from -devel subpackage are no longer needed rm %{buildroot}%{_libdir}/frr/*.so @@ -196,6 +219,9 @@ make check PYTHON=%{__python3} %{_tmpfilesdir}/%{name}.conf %changelog +* Wed Jul 21 2021 Michal Ruprich - 7.5.1-6 +- Resolves: #1983967 - ospfd crashes in route_node_delete with assertion fail + * Wed Jun 16 2021 Mohan Boddu - 7.5.1-5 - Rebuilt for RHEL 9 BETA for openssl 3.0 Related: rhbz#1971065