Bug 248249

Summary: net/frr7: fix crash on config read
Product: Ports & Packages Reporter: Kurt Jaeger <pi>
Component: Individual Port(s)Assignee: Olivier Cochard <olivier>
Status: Closed FIXED    
Severity: Affects Only Me CC: otis
Priority: --- Flags: bugzilla: maintainer-feedback? (olivier)
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
patch none

Description Kurt Jaeger freebsd_committer freebsd_triage 2020-07-24 18:56:16 UTC
Created attachment 216750 [details]
patch

Thanks to the slack channel and
  https://github.com/FRRouting/frr/pull/6772/files
Comment 1 Juraj Lutter freebsd_committer freebsd_triage 2020-07-24 19:35:00 UTC
root@dev12:/usr/ports/net/frr7 # lldb ./work/frr-frr-7.4/bgpd/.libs/bgpd -- --log stdout --log-level debug
(lldb) target create "./work/frr-frr-7.4/bgpd/.libs/bgpd"
Current executable set to './work/frr-frr-7.4/bgpd/.libs/bgpd' (x86_64).
(lldb) settings set -- target.run-args  "--log" "stdout" "--log-level" "debug"
(lldb) run
Process 73192 launching
Process 73192 launched: '/usr/ports/net/frr7/work/frr-frr-7.4/bgpd/.libs/bgpd' (x86_64)
Process 73192 stopped
* thread #1, name = 'bgpd', stop reason = signal SIGBUS: hardware error
    frame #0: 0x00000008008526dc libc.so.7`memcpy + 188
libc.so.7`memcpy:
->  0x8008526dc <+188>: movl   %edx, (%rdi)
    0x8008526de <+190>: movl   %r8d, -0x4(%rdi,%rcx)
    0x8008526e3 <+195>: retq
    0x8008526e4 <+196>: nopw   %cs:(%rax,%rax)
(lldb) bt
* thread #1, name = 'bgpd', stop reason = signal SIGBUS: hardware error
  * frame #0: 0x00000008008526dc libc.so.7`memcpy + 188
    frame #1: 0x00000008004e6de5 libfrr.so.0`vbprintfrr + 7509
    frame #2: 0x00000008004e738a libfrr.so.0`vasnprintfrr + 90
    frame #3: 0x00000008004e1e44 libfrr.so.0`zlog_msg_text + 84
    frame #4: 0x00000008004e28e9 libfrr.so.0`zlog_fd + 441
    frame #5: 0x00000008004e1caf libfrr.so.0`vzlog + 879
    frame #6: 0x000000080048ee4d libfrr.so.0`___lldb_unnamed_symbol349$$libfrr.so.0 + 141
    frame #7: 0x000000080048f2ce libfrr.so.0`frr_run + 334
    frame #8: 0x00000000002a787f bgpd`main + 671
    frame #9: 0x00000000002a710f bgpd`_start(ap=<unavailable>, cleanup=<unavailable>) at crt1.c:76:7
(lldb)

Doing further debugging.
Comment 2 Juraj Lutter freebsd_committer freebsd_triage 2020-07-24 19:57:42 UTC
WITH_DeBUG:

* thread #1, name = 'bgpd', stop reason = signal SIGBUS: hardware error
  * frame #0: 0x000000080094d6dc libc.so.7`memcpy + 188
    frame #1: 0x00000008005e246c libfrr.so.0`io_print(iop=0x00007fffffffe360, ptr="bgpd", len=4) at printfcommon.h:78:2
    frame #2: 0x00000008005e2283 libfrr.so.0`vbprintfrr(cb=0x00007fffffffe4d8, fmt0="%s %s starting: %svty@%d%s", ap=0x00007fffffffe540) at vfprintf.c:709:3
    frame #3: 0x00000008005e31cb libfrr.so.0`vasnprintfrr(mt=0x00000008005f2540, out="", outsz=8191, fmt="%s %s starting: %svty@%d%s", ap=0x00007fffffffe540) at glue.c:103:8
    frame #4: 0x00000008005d9c34 libfrr.so.0`zlog_msg_text(msg=0x000000080212f818, textlen=0x00007fffffffe6a0) at zlog.c:496:15
    frame #5: 0x00000008005dae2a libfrr.so.0`zlog_fd(zt=0x0000000800c9a050, msgs=0x0000000802131c18, nmsgs=1) at zlog_targets.c:107:34
    frame #6: 0x00000008005d944d libfrr.so.0`zlog_tls_buffer_flush at zlog.c:342:3
    frame #7: 0x00000008005d9816 libfrr.so.0`vzlog_tls(zlog_tls=0x000000080212f800, prio=5, fmt="%s %s starting: %svty@%d%s", ap=0x00007fffffffe8e0) at zlog.c:442:3
    frame #8: 0x00000008005d95eb libfrr.so.0`vzlog(prio=5, fmt="%s %s starting: %svty@%d%s", ap=0x00007fffffffe8e0) at zlog.c:454:3
    frame #9: 0x0000000800553f6a libfrr.so.0`zlog(prio=5, fmt="%s %s starting: %svty@%d%s") at zlog.h:56:2
    frame #10: 0x0000000800554551 libfrr.so.0`frr_run(master=0x0000000800cc1000) at libfrr.c:1061:2
    frame #11: 0x00000000002afc5d bgpd`main(argc=5, argv=0x00007fffffffeb10) at bgp_main.c:498:2
    frame #12: 0x00000000002af10f bgpd`_start(ap=<unavailable>, cleanup=<unavailable>) at crt1.c:76:7
Comment 3 Olivier Cochard freebsd_committer freebsd_triage 2020-07-24 20:04:25 UTC
(In reply to Juraj Lutter from comment #2)
Do you mean that with this patch applied, it doesn't solve your crash?
Comment 4 Juraj Lutter freebsd_committer freebsd_triage 2020-07-24 20:11:14 UTC
OK, it does solve it. The patch was not applied properly the first time (due to my error).

Confirmed, works.
Comment 5 commit-hook freebsd_committer freebsd_triage 2020-07-24 20:22:07 UTC
A commit references this bug:

Author: olivier
Date: Fri Jul 24 20:21:33 UTC 2020
New revision: 543378
URL: https://svnweb.freebsd.org/changeset/ports/543378

Log:
  Fix crash on config read

  PR:		248249
  Submitted by:	pi
  Reported by:	Raul Munos <raul.munoz@custos.es>, Juraj Lutter <juraj@lutter.sk>

Changes:
  head/net/frr7/Makefile
  head/net/frr7/files/patch-lib_zlog.c
Comment 6 Olivier Cochard freebsd_committer freebsd_triage 2020-07-24 20:24:35 UTC
Thanks a lot Kurt!