Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/1] package/ntp: add a patch to fix crashes
@ 2024-09-04 11:49 TIAN Yuanhao
  2024-10-29 21:52 ` Thomas Petazzoni via buildroot
  0 siblings, 1 reply; 3+ messages in thread
From: TIAN Yuanhao @ 2024-09-04 11:49 UTC (permalink / raw)
  To: buildroot; +Cc: Bernd Kuhls, TIAN Yuanhao

This patch fixes a regression [1] introduced in ntpd 4.2.8p18 [2].

  ntpd[200]: Listen normally on 3 lo [::1]:123
  ntpd[200]: bind(20) AF_INET6 [fe80::bf3d:254d:dee0:d345%3]:123 flags 0x811 failed: Cannot assign requested address
  ntpd[200]: unable to create socket on enp0s3 (4) for [fe80::bf3d:254d:dee0:d345%3]:123
  ntpd[192]: daemon control: got EOF
  ntpd[192]: daemon child died with signal 11
  systemd[1]: ntpd.service: Control process exited, code=exited, status=70/SOFTWARE
  systemd[1]: ntpd.service: Failed with result 'exit-code'.
  systemd[1]: Failed to start Network Time Service.

If the IPv6 link-local interface was not ready for binding on the first
attempt, ntpd would segfault in update_interfaces(). The segfault would
only occur when ntpd was started as part of the boot sequence. Most
- but not all - boots were affected. Evidently it could happen that the
timing of ntpd's start up was delayed enough that the IPv6 link-local
interface was ready for the bind() call when it was first issued by
open_socket() via create_interface().

[1]: https://bugs.ntp.org/show_bug.cgi?id=3928
[2]: https://bugs.ntp.org/show_bug.cgi?id=3913

Signed-off-by: TIAN Yuanhao <tianyuanhao3@163.com>
Cc: Bernd Kuhls <bernd.kuhls@t-online.de>
---
 ...-Fix-crash-when-binding-IPv6-address.patch | 33 +++++++++++++++++++
 1 file changed, 33 insertions(+)
 create mode 100644 package/ntp/0003-Fix-crash-when-binding-IPv6-address.patch

diff --git a/package/ntp/0003-Fix-crash-when-binding-IPv6-address.patch b/package/ntp/0003-Fix-crash-when-binding-IPv6-address.patch
new file mode 100644
index 0000000000..0219132891
--- /dev/null
+++ b/package/ntp/0003-Fix-crash-when-binding-IPv6-address.patch
@@ -0,0 +1,33 @@
+Fix crash when binding IPv6 address
+
+Reference:
+  https://bugs.ntp.org/show_bug.cgi?id=3928
+
+Signed-off-by: TIAN Yuanhao <tianyuanhao3@163.com>
+---
+ ntpd/ntp_io.c |    6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+Index: ntp-4.2.8p18/ntpd/ntp_io.c
+===================================================================
+--- ntp-4.2.8p18.orig/ntpd/ntp_io.c
++++ ntp-4.2.8p18/ntpd/ntp_io.c
+@@ -1917,15 +1917,15 @@ update_interfaces(
+ 			}
+ 			new_interface_found = TRUE;
+ 			DPRINT_INTERFACE(3,
+-				(ep, "updating ", " new - created\n"));
++				(ep2, "updating ", " new - created\n"));
+ 		}
+ 		else {
+ 			DPRINT_INTERFACE(3,
+-				(ep, "updating ", " new - FAILED"));
++				(ep2, "updating ", " new - FAILED"));
+ 
+ 			msyslog(LOG_ERR,
+ 				"cannot bind address %s",
+-				stoa(&ep->sin));
++				stoa(&ep2->sin));
+ 		}
+ 		free(ep2);
+ 	}
-- 
2.45.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-11-20 20:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-04 11:49 [Buildroot] [PATCH 1/1] package/ntp: add a patch to fix crashes TIAN Yuanhao
2024-10-29 21:52 ` Thomas Petazzoni via buildroot
2024-11-20 20:46   ` Peter Korsgaard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox