Go to file
Donald Sharp 71712f0bf6 mgmtd: Prevent use after free
ci is picking up this use after free on occasion:

    ERROR: AddressSanitizer: attempting to call malloc_usable_size() for pointer which is not owned: 0x6030001d94a0
        0 0x7fab994b7f04 in __interceptor_malloc_usable_size ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:119
        1 0x7fab994264f6 in __sanitizer::BufferedStackTrace::Unwind(unsigned long, unsigned long, void*, bool, unsigned int) ../../../../src/libsanitizer/sanitizer_common/sanitizer_stacktrace.h:131
        2 0x7fab994264f6 in __asan::asan_malloc_usable_size(void const*, unsigned long, unsigned long) ../../../../src/libsanitizer/asan/asan_allocator.cpp:1058
        3 0x7fab99039bcf in mt_count_free lib/memory.c:78
        4 0x7fab99039bcf in qfree lib/memory.c:130
        5 0x7fab98ff971a in hash_clean lib/hash.c:290
        6 0x56110cdb0e7f in mgmt_txn_hash_destroy mgmtd/mgmt_txn.c:1881
        7 0x56110cdb0e7f in mgmt_txn_destroy mgmtd/mgmt_txn.c:2013
        8 0x56110cd8e5de in mgmt_terminate mgmtd/mgmt.c:91
        9 0x56110cd8e003 in sigint mgmtd/mgmt_main.c:90
        10 0x7fab990bf4b0 in frr_sigevent_process lib/sigevent.c:117
        11 0x7fab990ea7a1 in event_fetch lib/event.c:1740
        12 0x7fab9901a24e in frr_run lib/libfrr.c:1245
        13 0x56110cd8e21f in main mgmtd/mgmt_main.c:290
        14 0x7fab98af9249 in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
        15 0x7fab98af9304 in __libc_start_main_impl ../csu/libc-start.c:360
        16 0x56110cd8dd30 in _start (/usr/lib/frr/mgmtd+0x3ad30)

    0x6030001d94a0 is located 0 bytes inside of 24-byte region [0x6030001d94a0,0x6030001d94b8)
    freed by thread T0 here:
        0 0x7fab994b76a8 in __interceptor_free ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:52
        1 0x7fab99039bf0 in qfree lib/memory.c:131
        2 0x7fab98ff93e1 in hash_release lib/hash.c:227
        3 0x56110cdaabdc in mgmt_txn_unlock mgmtd/mgmt_txn.c:1931
        4 0x56110cdab049 in mgmt_txn_delete mgmtd/mgmt_txn.c:1841
        5 0x56110cdab0ce in mgmt_txn_hash_free mgmtd/mgmt_txn.c:1864
        6 0x7fab98ff970b in hash_clean lib/hash.c:288
        7 0x56110cdb0e7f in mgmt_txn_hash_destroy mgmtd/mgmt_txn.c:1881
        8 0x56110cdb0e7f in mgmt_txn_destroy mgmtd/mgmt_txn.c:2013
        9 0x56110cd8e5de in mgmt_terminate mgmtd/mgmt.c:91
        10 0x56110cd8e003 in sigint mgmtd/mgmt_main.c:90
        11 0x7fab990bf4b0 in frr_sigevent_process lib/sigevent.c:117
        12 0x7fab990ea7a1 in event_fetch lib/event.c:1740
        13 0x7fab9901a24e in frr_run lib/libfrr.c:1245
        14 0x56110cd8e21f in main mgmtd/mgmt_main.c:290
        15 0x7fab98af9249 in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58

    previously allocated by thread T0 here:
        0 0x7fab994b83b7 in __interceptor_calloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:77
        1 0x7fab990392fd in qcalloc lib/memory.c:106
        2 0x7fab98ff8b4f in hash_get lib/hash.c:156
        3 0x56110cdb13ae in mgmt_txn_create_new mgmtd/mgmt_txn.c:1825
        4 0x56110cdb3b4d in mgmt_txn_notify_be_adapter_conn mgmtd/mgmt_txn.c:2212
        5 0x56110cd91178 in mgmt_be_adapter_conn_init mgmtd/mgmt_be_adapter.c:842
        6 0x7fab990ec6de in event_call lib/event.c:2019
        7 0x7fab9901a243 in frr_run lib/libfrr.c:1246
        8 0x56110cd8e21f in main mgmtd/mgmt_main.c:290
        9 0x7fab98af9249 in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58

The only time that mgmt_txn_hash_free is called is in hash_clean.
There are other places that mgmt_txn_unlock/delete are called and
hash_release should be called.  Let's just notice when mgmtd is
being called from the hash_clean and not call hash_release (since
we know it is being released already)

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
(cherry picked from commit 62f35c7bdb)
2025-02-27 20:40:07 +00:00
.github tests: ci: add ARM to docker based CI test 2025-01-18 01:59:47 +00:00
alpine docker: Set ABUILD_APK_INDEX_OPTS for frr build 2024-06-14 16:33:32 +03:00
babeld babel: Clean babel related config on daemon stop 2025-01-02 13:15:45 +02:00
bfdd bfdd: Use pass by reference for bfd_key_delete 2025-02-12 18:01:22 +00:00
bgpd bgpd: fix leaving hidden state 2025-02-27 09:43:57 +01:00
debian Merge pull request #17375 from opensourcerouting/fix/use_pcre2 2024-11-18 12:34:18 -05:00
doc doc: Say that 0.0.0.0 (0) BGP identifier is invalid 2025-02-04 16:37:55 +00:00
docker docker: add ubuntu24-ci docker image support 2025-01-12 02:48:29 +00:00
eigrpd *: Modify agentx to be allowed to be called 2024-05-10 10:16:29 -04:00
fpm fpm: guard against garbage in unused address bytes 2025-02-11 08:43:28 +00:00
gdb lib: add simplified native msg support 2023-12-26 08:34:56 -05:00
grpc build: throw in a few more XREF_SETUP 2024-05-09 18:02:49 +02:00
include isisd: vlan-subif isis neighbor 2024-08-01 09:09:35 +08:00
isisd isisd: Request SRv6 locator after zebra connection 2025-02-15 14:40:39 +00:00
ldpd ldpd: free previous config if it wasn't applied 2024-10-16 13:30:25 +02:00
lib lib: nb: fix oper-state queries that involve choice/case nodes 2025-02-22 20:07:56 +00:00
m4 m4: Update ax_lua to support Lua 5.4 2025-01-13 14:13:36 +02:00
mgmtd mgmtd: Prevent use after free 2025-02-27 20:40:07 +00:00
mlag build: throw in a few more XREF_SETUP 2024-05-09 18:02:49 +02:00
nhrpd nhrpd: fix dont consider incomplete L2 entry 2025-02-12 02:58:06 +00:00
ospf6d ospf6d: guard a couple of debugs 2025-01-09 17:26:10 -06:00
ospfclient ospfclient: fix crash due to streamwriter garbage collect 2024-12-20 14:41:20 -05:00
ospfd ospfd: Fix Coverity SA #1617470, 76 and 78 2025-02-06 16:16:48 +00:00
pathd pathd: Replace ctime_r() with time_to_string() 2024-12-20 17:58:49 +02:00
pbrd pbrd: initialize structs used in hash_lookup 2025-02-11 08:43:28 +00:00
pceplib Merge pull request #15215 from donaldsharp/pceplib_fixup 2024-01-25 09:59:59 +02:00
pimd Merge pull request #18207 from FRRouting/mergify/bp/dev/10.3/pr-17666 2025-02-26 11:15:31 -05:00
pkgsrc build: homologize path handling 2024-01-27 19:02:52 +01:00
python tools: Fix syntax raw parsing for make-foobar helper 2024-11-18 11:04:27 +02:00
qpb *: add XREF_SETUP() to libraries and utilites 2024-05-02 23:03:08 +02:00
redhat redhat: Specify minimum libyang version requirement 2025-01-23 14:49:13 +01:00
ripd lib: northbound/mgmtd: add backend model support 2025-01-14 18:48:59 +00:00
ripngd lib: northbound/mgmtd: add backend model support 2025-01-14 18:48:59 +00:00
sharpd Merge pull request #17445 from cscarpitta/fix/sharp-use-ipv6-max-bitlen 2024-11-17 14:19:58 +02:00
snapcraft bfdd: remove control socket obsolete code 2024-07-25 10:37:11 -03:00
staticd staticd: Fix SRv6 SID installation and deletion 2025-02-13 18:38:16 +00:00
tests tests: check as number in show run 2025-02-27 09:43:58 +01:00
tools tools: Fix frr-reload for ebgp-multihop TTL reconfiguration. 2025-01-29 04:43:17 +00:00
vrrpd vrrpd: iterate over all ancillary messages 2024-10-07 13:05:10 -03:00
vtysh Merge pull request #17336 from forrestchu/sbfd 2025-02-04 06:36:43 -05:00
watchfrr watchfrr: increase restart timer 20s -> 90s 2024-12-09 12:35:42 -05:00
yang Merge pull request #17336 from forrestchu/sbfd 2025-02-04 06:36:43 -05:00
zebra zebra: guard against junk in nexthop->rmap_src 2025-02-11 08:43:29 +00:00
.clang-format *: Modify clang-format column limit to 100 2024-09-26 09:58:32 -04:00
.dockerignore docker: Make docker image on CentOS 7 2019-11-26 19:29:30 +00:00
.flake8 style: add format checker config that matches FRR style standards 2023-04-18 05:18:26 -04:00
.git-blame-ignore-revs tools: Add black formatting commit to .git-blame-ignore-revs 2024-04-28 12:50:51 +03:00
.gitignore python: add tool to expand typesafe definitions 2024-04-29 17:37:49 +02:00
.isort.cfg style: add format checker config that matches FRR style standards 2023-04-18 05:18:26 -04:00
.pylintrc style: add format checker config that matches FRR style standards 2023-04-18 05:18:26 -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: update packaging & docs for dir changes 2024-01-27 19:01:19 +01:00
config.version.in build: carry --with-pkg-extra-version into tarballs 2018-10-24 15:11:50 +02:00
configure.ac configure: Adopt for Lua 5.4 2025-01-13 16:34:14 +02:00
COPYING *: sort out & explain licenses used in FRR 2023-02-09 12:46:13 +01:00
Makefile.am build: homologize path handling 2024-01-27 19:02:52 +01:00
README.md doc: Fix the link that points to Slack invitation in README 2022-03-24 13:13:37 +02: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