How do I debug a Segmentation fault from ntpmon?

Hal Murray halmurray at sonic.net
Fri Jun 19 09:55:51 UTC 2026


Thanks.  gdb on the core dump says the stack is trashed and doesn't give 
any useful info.

ntpmon is a python program.

gdb python
run /usr/local/bin/ntpmon

works for a while, then see attached.


I've seen a slightly similar crash in ntpd when it was trying to write out 
a rawstats line.  The address it was trying to print wasn't either IPv4 or 
IPv6, or something like that.  I assume that memory had beem trashed.  I 
didn't save anything from that one.

I recently upgraded that system from 15.0 to 15.1.  It was working fine 
before that.  Post update, it started getting mysterious crashes, I 
guessed that the upgrade didn't take, so this is now a fresh install.

Either we have uncovered a bug in FreeBSD, or they have discovered a bug 
in our code.  Either way, it seems pretty obscure and worth tracking down.


-------------- next part --------------
(No debugging symbols found in python)
(gdb) run /usr/local/bin/ntpmon
Starting program: /usr/local/bin/python /usr/local/bin/ntpmon
warning: File "/usr/local/lib/libpython3.11.so.1.0-gdb.py" auto-loading has been declined by your `auto-load safe-path' set to "$debugdir:$datadir/auto-load".
To enable execution of this file add
	add-auto-load-safe-path /usr/local/lib/libpython3.11.so.1.0-gdb.py
line to your configuration file "/home/murray/.config/gdb/gdbinit".
To completely disable this security protection add
	set auto-load safe-path /
line to your configuration file "/home/murray/.config/gdb/gdbinit".
For more information about this security protection see the
"Auto-loading safe path" section in the GDB manual.  E.g., run from the shell:
	info "(gdb)Auto-loading safe path"
[Detaching after fork from child process 2914]

     remote           refid      st t when poll reach   delay   offset   jitter
+glypnod-6       201.47.154.208   2 8    4   64  377   0.7100   0.4151   0.0380
*fed-pps-6       .PPS.            1 8    9   64  377   0.8216   0.4316   0.0553
-bob-pps-6       .GPS.            1 8   13   64  377   0.8845   1.4732   0.1411
+ted-pps-6       .PPS.            1 8    -   64  377   0.7963   0.4301   0.0641
+deb32-6         201.47.154.208   2 u   55   64  377   0.6428   0.4182   0.0428
+bob32-6         192.168.1.83     2 u   29   64  377   0.6341   0.4394   0.0739
-ntp3-6          .PPS.            1 8   41   64  377   0.7472   0.4653   0.0396
+ntp5-6          .PPS.            1 8    -   64  377   0.7078   0.4284   0.0291
-fed-rp3-6       222.20.195.39    2 u   36   64  377   0.9572   0.3359   0.0543
ntpd ntpsec-1.2.4 2026-06-12/14:17:32         Updated: 2026-06-19T01:05:51 (32)
 lstint avgint rstr r m v  count    score   drop rport remote address
      0   3.66    0 . 6 2    545    0.749      0 41102 localhost
      0     64    0 . 4 4    108    0.052      0  8123 ted-pps-6
      0     64    0 . 4 4    109    0.052      0  8123 ntp5-6
      4     65    0 . 4 4    106    0.052      0  8123 glypnod-6
      9     65    0 . 4 4    107    0.052      0  8123 fed-pps-6
     13     65    0 . 4 4    107    0.052      0  8123 bob-pps-6
     17     65    0 . 3 4    105    0.052      0  8123 web-6
     29     64    0 . 4 4    108    0.052      0   123 bob32-6
     35     66    0 . 3 4    105    0.052      0  8123 mon-4
     36     63    0 . 4 4    109    0.052      0   123 fed-rp3-6
     41     64    0 . 4 4    108    0.052      0  8123 ntp3-6
     42     65    0 . 3 4    105    0.052      0  8123 web-4
     55     64    0 . 4 4    107    0.052      0   123 deb32-6
    110    149    0 . 3 4     45    0.050      0  8123 spare-4
                                                              Program received signal SIGSEGV, Segmentation fault.
                                  Invalid permissions for mapped object.
                                                                        vsprintf (
    str=0xffffffffdee2 "\020@\001\004\020@\001\004\020@\001\004\020@\005", 
    fmt=0x40c484f5 "%x", ap=...) at /usr/src/lib/libc/stdio/vsprintf.c:67
warning: 67	/usr/src/lib/libc/stdio/vsprintf.c: No such file or directory
(gdb) bt
#0  vsprintf (
    str=0xffffffffdee2 "\020@\001\004\020@\001\004\020@\001\004\020@\005", 
    fmt=0x40c484f5 "%x", ap=...) at /usr/src/lib/libc/stdio/vsprintf.c:67
#1  0x0000000040d31090 in sprintf (
    str=str at entry=0xffffffffdee2 "\020@\001\004\020@\001\004\020@\001\004\020@\005", fmt=fmt at entry=0x40c484f5 "%x") at /usr/src/lib/libc/stdio/sprintf.c:55
#2  0x0000000040cdecf4 in inet_ntop6 (src=0x4155d308 "&", dst=<optimized out>, 
    size=<optimized out>) at /usr/src/lib/libc/inet/inet_ntop.c:174
#3  __inet_ntop (af=<optimized out>, src=0x4155d308, dst=0xffffffffdf8a "f@", 
    size=46) at /usr/src/lib/libc/inet/inet_ntop.c:59
#4  0x00000000429560c0 in ?? ()
   from /usr/local/lib/python3.11/lib-dynload/_socket.cpython-311.so
#5  0x00000000429555b4 in ?? ()
   from /usr/local/lib/python3.11/lib-dynload/_socket.cpython-311.so
#6  0x000000004068cde8 in ?? () from /usr/local/lib/libpython3.11.so.1.0
#7  0x0000000040636cbc in _PyObject_MakeTpCall ()
   from /usr/local/lib/libpython3.11.so.1.0
#8  0x000000004072eaec in _PyEval_EvalFrameDefault ()
   from /usr/local/lib/libpython3.11.so.1.0
#9  0x0000000040728b08 in PyEval_EvalCode ()
   from /usr/local/lib/libpython3.11.so.1.0
#10 0x000000004078dda8 in ?? () from /usr/local/lib/libpython3.11.so.1.0
#11 0x000000004078d7c4 in _PyRun_SimpleFileObject ()
   from /usr/local/lib/libpython3.11.so.1.0
#12 0x000000004078c99c in _PyRun_AnyFileObject ()
--Type <RET> for more, q to quit, c to continue without paging--
   from /usr/local/lib/libpython3.11.so.1.0
#13 0x00000000407b4580 in ?? () from /usr/local/lib/libpython3.11.so.1.0
#14 0x00000000407b3c4c in Py_RunMain () from /usr/local/lib/libpython3.11.so.1.0
#15 0x00000000407b5144 in ?? () from /usr/local/lib/libpython3.11.so.1.0
#16 0x00000000407b5434 in Py_BytesMain () from /usr/local/lib/libpython3.11.so.1.0
#17 0x0000000040ca3020 in __libc_start1 (argc=2, argv=0xffffffffe980, env=0xffffffffe998, cleanup=<optimized out>, mainX=0x2105d0)
    at /usr/src/lib/libc/csu/libc_start1.c:180
#18 0x00000000002105c4 in _start ()
(gdb) 


-------------- next part --------------
-- 
These are my opinions.  I hate spam.



More information about the devel mailing list