Go to file
Donald Sharp 07b9ebca65 zebra: Ensure zebra_nhg_sweep_table accounts for double deletes
I'm seeing this crash in various forms:
Program terminated with signal SIGSEGV, Segmentation fault.
50 ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
[Current thread is 1 (Thread 0x7f418efbc7c0 (LWP 3580253))]
(gdb) bt
(gdb) f 4
267 (*func)(hb, arg);
(gdb) p hb
$1 = (struct hash_bucket *) 0x558cdaafb250
(gdb) p *hb
$2 = {len = 0, next = 0x0, key = 0, data = 0x0}
(gdb)

I've also seen a crash where data is 0x03.

My suspicion is that hash_iterate is calling zebra_nhg_sweep_entry which
does delete the particular entry we are looking at as well as possibly other
entries when the ref count for those entries gets set to 0 as well.

Then we have this loop in hash_iterate.c:

   for (i = 0; i < hash->size; i++)
            for (hb = hash->index[i]; hb; hb = hbnext) {
                    /* get pointer to next hash bucket here, in case (*func)
                     * decides to delete hb by calling hash_release
                     */
                    hbnext = hb->next;
                    (*func)(hb, arg);
            }
Suppose in the previous loop hbnext is set to hb->next and we call
zebra_nhg_sweep_entry. This deletes the previous entry and also
happens to cause the hbnext entry to be deleted as well, because of nhg
refcounts. At this point in time the memory pointed to by hbnext is
not owned by the pthread anymore and we can end up on a state where
it's overwritten by another pthread in zebra with data for other incoming events.

What to do?  Let's change the sweep function to a hash_walk and have
it stop iterating and to start over if there is a possible double
delete operation.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-02-04 12:05:38 -05:00
.github .github: improve bug report template 2020-10-20 16:12:03 -04:00
alpine alpine: fix path for daemons file install 2021-08-30 15:21:59 -04:00
babeld *: do not print vrf name for interface config when using vrf-lite 2022-01-24 14:44:05 +03:00
bfdd Merge pull request #10388 from anlancs/bfd-fsm-passive 2022-02-02 13:06:11 +03:00
bgpd bgpd: strncmp -> strcmp in community hash foo 2022-02-02 16:34:03 -05:00
debian debian: adjust the changelog for the dev branch 2021-11-08 11:54:42 -06:00
doc Merge pull request #10495 from anlancs/doc-ospf-range 2022-02-04 15:28:38 +03:00
docker docker: update alpine build enable set own version 2022-01-04 13:14:51 -05:00
eigrpd *: rework renaming the default VRF 2021-12-21 22:09:29 +03:00
fpm build: fix AM_LDFLAGS usage (and gcov) 2021-07-21 17:10:08 +02:00
gdb *: Cleanup some documentation from quagga->frr 2021-11-11 14:41:27 -05:00
grpc build: fix AM_LDFLAGS usage (and gcov) 2021-07-21 17:10:08 +02:00
include include, zebra: Add recent nexthop.h 2021-10-25 14:11:37 -04:00
isisd bgpd,pimd,isisd,nhrpd: Convert to vty_json() 2022-01-31 21:20:41 +02:00
ldpd *: rework renaming the default VRF 2021-12-21 22:09:29 +03:00
lib bgpd: Convert bgp_addpath_encode_[tr]x() to bool from int 2022-02-01 13:31:16 +02:00
m4 grpc: improve checks for GRPC C++ requirements 2021-05-22 00:01:06 +00:00
mlag build: fix AM_LDFLAGS usage (and gcov) 2021-07-21 17:10:08 +02:00
nhrpd bgpd,pimd,isisd,nhrpd: Convert to vty_json() 2022-01-31 21:20:41 +02:00
ospf6d Merge pull request #10373 from anlancs/ospf-add-asbr 2022-02-01 19:04:33 +03:00
ospfclient build: fix AM_LDFLAGS usage (and gcov) 2021-07-21 17:10:08 +02:00
ospfd ospfd: Core in ospf_if_down during shutdown. 2022-02-04 10:26:54 +02:00
pathd pathd: fix typo in pathd/path_ted.c 2021-12-19 11:25:15 +00:00
pbrd *: do not print vrf name for interface config when using vrf-lite 2022-01-24 14:44:05 +03:00
pceplib pceplib: fix style issues 2021-12-06 00:09:13 -05:00
pimd bgpd,pimd,isisd,nhrpd: Convert to vty_json() 2022-01-31 21:20:41 +02:00
pkgsrc *: cleanup .gitignore files 2018-09-08 21:30:42 +02:00
python python: pass conditionals through clippy for DEFPY 2022-01-13 16:01:53 +01:00
qpb build: fix AM_LDFLAGS usage (and gcov) 2021-07-21 17:10:08 +02:00
redhat redhat: logrotate file has typo for staticd 2022-01-24 15:05:48 -05:00
ripd *: rework renaming the default VRF 2021-12-21 22:09:29 +03:00
ripngd *: rework renaming the default VRF 2021-12-21 22:09:29 +03:00
sharpd *: rework renaming the default VRF 2021-12-21 22:09:29 +03:00
snapcraft snapcraft: add missing dependency 2021-08-23 15:08:05 +03:00
staticd staticd: small cleanup 2022-01-31 18:44:17 +08:00
tests Merge pull request #10464 from pguibert6WIND/negogiate 2022-02-01 13:00:54 -05:00
tools tools: Handle new lines for json_object_to_json_string_ext() 2022-01-31 15:34:24 +02:00
vrrpd vrrpd: use ipaddr_is_zero when needed 2022-01-27 21:05:40 +03:00
vtysh zebra: fix segment-routing command not found error with --disable-pathd 2022-01-16 21:46:22 +09:00
watchfrr *: Convert quagga_signal_X to frr_signal_X 2021-11-11 14:41:27 -05:00
yang bfdd,yang: optimize nb with YANG 2022-01-25 04:00:49 -05:00
zebra zebra: Ensure zebra_nhg_sweep_table accounts for double deletes 2022-02-04 12:05:38 -05:00
.clang-format *: Add FOREACH_AFI_SAFI_NSF(afi, safi) macro to reduce nesting 2022-01-13 14:29:54 +02:00
.dir-locals.el tests: remove python format block from dir-locals 2021-09-13 10:04:29 -04:00
.dockerignore docker: Make docker image on CentOS 7 2019-11-26 19:29:30 +00:00
.git-blame-ignore-revs tools: Ignore mass renaming of topotests for git blame 2021-05-11 14:14:26 +03:00
.gitignore *: Add some missed make check generated files in .gitignore 2021-09-16 08:13:17 -04:00
.pylintrc tests: micronet: update infra 2021-09-04 09:04:46 -04:00
.travis.yml lib: libyang2 add missed conversion 2021-05-17 22:13:59 -04:00
bootstrap.sh build: turn on automake warnings (& symlinks) 2021-04-21 15:42:37 +02:00
buildtest.sh build: remove --enable-exampledir 2021-06-24 16:42:58 +02:00
config.version.in build: carry --with-pkg-extra-version into tarballs 2018-10-24 15:11:50 +02:00
configure.ac build: FRR 8.3 development version 2022-02-01 11:02:03 +02:00
COPYING *: make consistent & update GPLv2 file headers 2017-05-15 16:37:41 +02:00
COPYING-LGPLv2.1 build: remove LGPL v2.0, add LGPL v2.1 2016-11-15 17:19:38 +09:00
Makefile.am build: fix AM_LDFLAGS usage (and gcov) 2021-07-21 17:10:08 +02:00
README.md doc: Update Documentation to note Solaris Unsupported status 2020-09-21 10:02:20 -04:00
stamp-h.in Initial revision 2002-12-13 20:15:29 +00:00
version.h build: make builddir include path consistent 2021-04-21 15:42:33 +02:00

Icon

FRRouting

FRR is free software that implements and manages various IPv4 and IPv6 routing protocols. It runs on nearly all distributions of Linux and BSD and supports all modern CPU architectures.

FRR currently supports the following protocols:

  • BGP
  • OSPFv2
  • OSPFv3
  • RIPv1
  • RIPv2
  • RIPng
  • IS-IS
  • PIM-SM/MSDP
  • LDP
  • BFD
  • Babel
  • PBR
  • OpenFabric
  • VRRP
  • EIGRP (alpha)
  • NHRP (alpha)

Installation & Use

For source tarballs, see the releases page.

For Debian and its derivatives, use the APT repository at https://deb.frrouting.org/.

Instructions on building and installing from source for supported platforms may be found in the developer docs.

Once installed, please refer to the user guide for instructions on use.

Community

The FRRouting email list server is located here and offers the following public lists:

Topic List
Development dev@lists.frrouting.org
Users & Operators frog@lists.frrouting.org
Announcements announce@lists.frrouting.org

For chat, we currently use Slack. You can join by clicking the "Slack" link under the Participate section of our website.

Contributing

FRR maintains developer's documentation which contains the project workflow and expectations for contributors. Some technical documentation on project internals is also available.

We welcome and appreciate all contributions, no matter how small!

Security

To report security issues, please use our security mailing list:

security [at] lists.frrouting.org