Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 20 Nov 2025 22:38:38 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 291119] /usr/sbin/ntpd Segmentation fault (bind failed: Address already in use) when addresses are duplicated
Message-ID:  <bug-291119-227@https.bugs.freebsd.org/bugzilla/>

index | next in thread | raw e-mail

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=291119

            Bug ID: 291119
           Summary: /usr/sbin/ntpd Segmentation fault (bind failed:
                    Address already in use) when addresses are duplicated
           Product: Base System
           Version: 15.0-RELEASE
          Hardware: amd64
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: bin
          Assignee: bugs@FreeBSD.org
          Reporter: olevole@ya.ru

% uname -mr
15.0-RC2 amd64

possibly related to https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=281202

Incorrect processing leads to failure in the src/contrib/ntp/ntpd/ntp_io.c area
--
root@home:~# lldb -c /var/coredumps/ntpd.core `which ntpd`
(lldb) target create "/usr/sbin/ntpd" --core "/var/coredumps/ntpd.core"
Core file '/var/coredumps/ntpd.core' (x86_64) was loaded.
(lldb) bt
* thread #1, name = 'ntpd', stop reason = signal SIGSEGV
  * frame #0: 0x00000c61cacf3213 ntpd`socktoa(sock=0x0000000000000024) at
socktoa.c:46:10
    frame #1: 0x00000c61cac97b1a ntpd`update_interfaces(port=123,
receiver=0x0000000000000000, data=0x0000000000000000) at ntp_io.c:1926:5
    frame #2: 0x00000c61cac96a96 ntpd`io_open_sockets [inlined]
create_sockets(port=123) at ntp_io.c:2036:2
    frame #3: 0x00000c61cac9668b ntpd`io_open_sockets at ntp_io.c:513:2
    frame #4: 0x00000c61cac83ab3 ntpd`config_ntpd(ptree=0x000034896fa4a180,
input_from_files=<unavailable>) at ntp_config.c:5036:2
    frame #5: 0x00000c61cac817ad
ntpd`save_and_apply_config_tree(input_from_file=<unavailable>) at
ntp_config.c:5276:2 [artificial]
    frame #6: 0x00000c61cac8193c ntpd`getconfig(argc=0,
argv=0x00000c69eb4ede50) at ntp_config.c:5212:2
    frame #7: 0x00000c61cacb5560 ntpd`ntpdmain(argc=0, argv=0x00000c69eb4ede50)
at ntpd.c:1141:2
    frame #8: 0x00000c61cacb4dc9 ntpd`main(argc=<unavailable>,
argv=<unavailable>) at ntpd.c:445:9
    frame #9: 0x00000c69ef37e37f libc.so.7`__libc_start1(argc=2,
argv=0x00000c69eb4ede40, env=0x00000c69eb4ede58, cleanup=<unavailable>,
mainX=(ntpd`main at ntpd.c:426)) at libc_start1.c:180:7
    frame #10: 0x00000c61cac7ec31 ntpd`_start at crt1_s.S:80
(lldb) up
frame #1: 0x00000c61cac97b1a ntpd`update_interfaces(port=123,
receiver=0x0000000000000000, data=0x0000000000000000) at ntp_io.c:1926:5
   1923
   1924                         msyslog(LOG_ERR,
   1925                                 "cannot bind address %s",
-> 1926                                 stoa(&ep->sin));
   1927                 }
   1928                 free(ep2);
   1929         }
(lldb) 
frame #2: 0x00000c61cac96a96 ntpd`io_open_sockets [inlined]
create_sockets(port=123) at ntp_io.c:2036:2
   2033
   2034         create_wildcards(port);
   2035
-> 2036         update_interfaces(port, NULL, NULL);
   2037
   2038         /*
   2039          * Now that we have opened all the sockets, turn off the reuse
--



The easiest way to repeat ( create a duplicate address on different interfaces
):
```
service ntpd onestop || true

ifconfig bridge100 create
ifconfig bridge100 10.10.10.10/24

ifconfig bridge101 create
ifconfig bridge101 10.10.10.10/24

ntpd -n
```

-- 
You are receiving this mail because:
You are the assignee for the bug.

help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-291119-227>