From patchwork Sun Mar 9 15:19:51 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakob Kirsch X-Patchwork-Id: 39968 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 543F527BBE9; Sun, 9 Mar 2025 15:21:46 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-6.4 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE, SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 4A9E727BBE2 for ; Sun, 9 Mar 2025 15:21:43 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1trISg-0007FH-Jq; Sun, 09 Mar 2025 11:21:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1trISc-0007Dh-Pz for guix-patches@gnu.org; Sun, 09 Mar 2025 11:21:04 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1trISc-0002LK-Gw for guix-patches@gnu.org; Sun, 09 Mar 2025 11:21:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:From:Date:To:Subject; bh=Df0N113wBi5lBDXfLeL00eDVNlzFfS8z41TbXOiaL04=; b=iOgU2Y/0IJLKt6ux9E6/D8Quc2Vf7YnD//gHLDy7/tYKTTQgFHbuDwbr/N12XrFvjT20v6ObG8B8UurjS/bT43el0bZ9xRbyMutyK6CLU4anK9nWtyLQigP6h6hkcifVHKnEHlQFXGDLKPfgktOdy3tAOlCoh0qM07WocwFES3iVvsXeq7RUTdtvShC/l9vMm7nFvkwyre4y1QaR53Tv74MinYqUrtXkKyY1BmxOxaadnjHrgiWjnqzzF5D8clW9pRY+lQCyQpz+9DPd/KVVpYVqC/aF2+Hd+OV/OnlCOzQ184FxLMXS/CWVNBvMDpr648/gBk39KDZdbnQ73G+EaQ==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1trISc-0000H9-Aw for guix-patches@gnu.org; Sun, 09 Mar 2025 11:21:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#76892] [PATCH v1] gnu: ntp: Fix crash. Resent-From: Jakob Kirsch Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 09 Mar 2025 15:21:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 76892 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 76892@debbugs.gnu.org X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.1741533611960 (code B ref -1); Sun, 09 Mar 2025 15:21:02 +0000 Received: (at submit) by debbugs.gnu.org; 9 Mar 2025 15:20:11 +0000 Received: from localhost ([127.0.0.1]:33854 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1trIRm-0000FL-T8 for submit@debbugs.gnu.org; Sun, 09 Mar 2025 11:20:11 -0400 Received: from lists.gnu.org ([2001:470:142::17]:38900) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1trIRk-00009b-My for submit@debbugs.gnu.org; Sun, 09 Mar 2025 11:20:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1trIRe-00071o-7L for guix-patches@gnu.org; Sun, 09 Mar 2025 11:20:02 -0400 Received: from mout.web.de ([212.227.15.3]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1trIRb-0001mZ-8r for guix-patches@gnu.org; Sun, 09 Mar 2025 11:20:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=web.de; s=s29768273; t=1741533593; x=1742138393; i=jakob.kirsch@web.de; bh=Df0N113wBi5lBDXfLeL00eDVNlzFfS8z41TbXOiaL04=; h=X-UI-Sender-Class:Date:From:To:Subject:Message-ID:MIME-Version: Content-Type:cc:content-transfer-encoding:content-type:date:from: message-id:mime-version:reply-to:subject:to; b=AdPNh7xIVtkY+zRzOJsncAp2udhP2ZZJQT3bQxrd/0i5+YLLHTGk8wgOd4dEheIE Cbz+rqEjgIOBVL6Bkmd0rAAzsftBokl9gaAPzBryqExyUZlhSZ/fQEEaTfyFv1O2H XAS1DkGhe+K97KExZB9hY3q30VSfBjWz08OdCFCMt+54SekEBmsndqSvbrUBqk5PT MjicKdmmyhUEhgqShMb0YZ1/RcBVCv/Mi/BqcKc+TtVNjyJdW0TgiQSfEnnOh42NB 98KnSwpgL/fFRhVXKo59yoFVg1OrjbpKUPLj61pTbCWs8boNn1w+zbVOrPdFlMz3r SuPA8OwmzU/24WwBwQ== X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6 Received: from kernelpanicroom ([134.19.28.36]) by smtp.web.de (mrweb005 [213.165.67.108]) with ESMTPSA (Nemesis) id 1M3Ez3-1tnjXR48fV-008IwU for ; Sun, 09 Mar 2025 16:19:53 +0100 Date: Sun, 9 Mar 2025 16:19:51 +0100 Message-ID: MIME-Version: 1.0 Content-Disposition: inline X-Provags-ID: V03:K1:SJYG9Vb2YIBp6oH+zvPrMLDs4LH+hJYXQs5mglUhWOCiBd8LAw0 gUEWSUv3cXefcKgUDJtxlYBBDBXlvDH6wdQGNgdGFF96U24wBAxpza8SMVfsxWiNsQo4/e2 7eUXP7PUU7mFKL4Lcvy8QtjvzztD/xfh0RXPQZYXLGJSHcypWLs8Bv/+Jm9FKD3JhbV7qaz cNVwcctOkrSk7bwZ39lIQ== UI-OutboundReport: notjunk:1;M01:P0:6HqSdRS/0Rw=;EBZ9RxWVMk5SF3wQPTQPh2lVcqZ /B9UrCZ0sHGU8vlYGgOh9a1FzpJYUWEPg4KwfpIgIMlRSroEC/PEG5/ILWuVwnCm0Imp/V9y7 AtKiKa0OLjIdOwwC16yphL06osx51aRGV0LK0HqJFI3F5fuy+I3xEF33q9Ogz7jIWKU6SXt9X xqvlgSTBq59C0YMzC+RuioUQMmqz0TgaDIlcz+bepRfTqf0sxhnvvDM1JftchA2n05otxIVVA qUNZ0uHVxeObNZsV7wbgXdMrdgww20WXZx/GkeuixHQyfBsxSzrWfw9xcH/cXVVdgPj+W/74K ZXyQ+WTqhByDZG2mragAOgFAmzuGXgwT7J2YC+MP/FA+Q9EjJgD0DAcYxqZ86X2g0enW7oh5d BJQVSa2yfiMa2vvZdfoCl+2UwAvBm2HzdkD4UfRlyg61qVTSuHV273gA0t6pn7raoMCYbyE5A imz8ab7R7NCA2q32CJmd4ObuXd8ECS7D2ZZ64Rt6FWk6RcihDFrSgnFgjFg4NFq77ye9CCj2+ eMD+ZBgSePxQ6TR/tByMO70/ASLAQEfegz2WzCP71TzLAU5Afju6KPvXYPGGcUgb4lL+MkPaQ H+UCzPmJOVEsNa5L8GinrVlNhFLy5Uoh9ryRR1ssnVGH8PZP9rPhHQOzqxXzXmeRgs2nFA32/ 9ujxJw066EB9zIKK7VWrvD7Cz3kNu81YMENmxyX4i1vxCT7CKBgCnvnW/Hx+B68rWQ54OJ90S a0W1x9idmuEnkTtFI/YU+5ffDvZMJP+e6P8vaOzF0lHHR8sXvrdoPwDIevluh9NCgaww+7iju Pf2tvtynI3yeCt0UEzZCUwiI5JAd+ves/gMTsTL9pf1l5l84WgS9+iu1CJeUo8K258G9f1MJ5 7tVWVTduc4T2/6L6p77jwz0rAoJqZurMbNz5us2JtMkb4mpAhZIJCmS2ZCNFdXNKQx6dbAhjl CieWIIy9SQD3Tq1UqB9Oj1QmU1eJ8jBp89InNgMw/GB6p4dboO7CXOY/dzDaL+L1rtGbuI1Ln kJcc2DVYEojQGxR+qLcAO9ddodgvbmErheq33sqsWJt4BZ2wbOscQRqa/rNL5/dAnn9oln0mk +f8eCXnrUnLX1shNrgUab8j3JcsGeRsRPwSBXVI4mQPPXDC4udMFUjvSyBsnHCksE+bCbku7C Jokxzd+cNC/mX5NPpf/0DB6iF66a6tIzzp9xSSB/wAZPFcgVOPF9nfcOzW+8dihJF6b0UB2ka e0rxAzHABCwS5vx5COPBATQp0UR+hIL1zgqpX5Vs1r0wrl3DFQwBkRFsY8IdGWHGpa7JULpin V5s1mHN88jePrByXsFxurHaxMT/dGQZcderN7T+xtIrvYRoxWWR2nXt3sNfPzGj0bHXIjMnhY +mzEftFvFDgr2NuADDWjvfNA1QzsWM5oDxbP3FRS0mU6tHvPNnyar4uddQ Received-SPF: pass client-ip=212.227.15.3; envelope-from=jakob.kirsch@web.de; helo=mout.web.de X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Jakob Kirsch X-ACL-Warn: , Jakob Kirsch via Guix-patches X-Patchwork-Original-From: Jakob Kirsch via Guix-patches via From: Jakob Kirsch Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches ntpd segfaults at boot so here is a patch to fix that. From 3ebd9d493240978d5f2b14e55ed63754c43151c3 Mon Sep 17 00:00:00 2001 Message-ID: <3ebd9d493240978d5f2b14e55ed63754c43151c3.1741533506.git.jakob.kirsch@web.de> From: Jakob Kirsch Date: Sun, 9 Mar 2025 16:16:43 +0100 Subject: [PATCH v1] gnu: ntp: Fix crash. * gnu/packages/ntp.scm (ntp): Add patch. * gnu/packages/patches/ntp-fix-dereferencing-the-wrong-variable.patch: Add patch. * gnu/local.mk (dist_patch_DATA): Register patch. Change-Id: Ib3524c13fb2a1e6c70f8733cac3faeb427d00296 --- gnu/local.mk | 1 + gnu/packages/ntp.scm | 94 +++++++++---------- ...fix-dereferencing-the-wrong-variable.patch | 45 +++++++++ 3 files changed, 92 insertions(+), 48 deletions(-) create mode 100644 gnu/packages/patches/ntp-fix-dereferencing-the-wrong-variable.patch base-commit: c4f297a664869a18126b66eb5209de1fcceb42d8 -- 2.48.1 diff --git a/gnu/local.mk b/gnu/local.mk index 9082ed04bf..9658a7fd08 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1908,6 +1908,7 @@ dist_patch_DATA = \ %D%/packages/patches/nss-getcwd-nonnull.patch \ %D%/packages/patches/nss-increase-test-timeout.patch \ %D%/packages/patches/nss-3.56-pkgconfig.patch \ + %D%/packages/patches/ntp-fix-dereferencing-the-wrong-variable.patch \ %D%/packages/patches/nvi-assume-preserve-path.patch \ %D%/packages/patches/nvi-dbpagesize-binpower.patch \ %D%/packages/patches/nvi-db4.patch \ diff --git a/gnu/packages/ntp.scm b/gnu/packages/ntp.scm index 33ea790c9a..0b01f339d5 100644 --- a/gnu/packages/ntp.scm +++ b/gnu/packages/ntp.scm @@ -132,62 +132,60 @@ (define-public chrony (define-public ntp (package - (name "ntp") - (version "4.2.8p18") - (source + (name "ntp") + (version "4.2.8p18") + (source (origin (method url-fetch) (uri (list (string-append "https://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-" - (version-major+minor version) - "/ntp-" version ".tar.gz") - (string-append - "http://archive.ntp.org/ntp4/ntp-" - (version-major+minor version) - "/ntp-" version ".tar.gz"))) + (version-major+minor version) "/ntp-" version ".tar.gz") + (string-append "http://archive.ntp.org/ntp4/ntp-" + (version-major+minor version) "/ntp-" version + ".tar.gz"))) (sha256 (base32 "1rb8yksqxjcsjvww9kwnw1242qzszwixh916jj254a8szgrwb16g")) + (patches (search-patches + "ntp-fix-dereferencing-the-wrong-variable.patch")) (modules '((guix build utils))) - (snippet - '(begin - ;; Remove the bundled copy of libevent, but we must keep - ;; sntp/libevent/build-aux since configure.ac contains - ;; AC_CONFIG_AUX_DIR([sntp/libevent/build-aux]) - (rename-file "sntp/libevent/build-aux" - "sntp/libevent:build-aux") - (delete-file-recursively "sntp/libevent") - (mkdir "sntp/libevent") - (rename-file "sntp/libevent:build-aux" - "sntp/libevent/build-aux"))))) - (native-inputs (list which pkg-config)) - (inputs - (cons* openssl - libevent - ;; Build with POSIX capabilities support on GNU/Linux. This allows - ;; 'ntpd' to run as non-root (when invoked with '-u'.) - (if (target-linux?) - (list libcap) - '()))) - (arguments - (list - ;; Pass "--with-yielding-select=yes" so that 'configure' knows whether - ;; 'select' yields when using pthreads in a cross-compilation context. - #:configure-flags - #~(list "--with-yielding-select=yes") - #:phases - #~(modify-phases %standard-phases - (add-after 'unpack 'disable-network-test - (lambda _ - (substitute* "tests/libntp/Makefile.in" - (("test-decodenetnum\\$\\(EXEEXT\\) ") ""))))))) - (build-system gnu-build-system) - (synopsis "Real time clock synchronization system") - (description "NTP is a system designed to synchronize the clocks of + (snippet '(begin + ;; Remove the bundled copy of libevent, but we must keep + ;; sntp/libevent/build-aux since configure.ac contains + ;; AC_CONFIG_AUX_DIR([sntp/libevent/build-aux]) + (rename-file "sntp/libevent/build-aux" + "sntp/libevent:build-aux") + (delete-file-recursively "sntp/libevent") + (mkdir "sntp/libevent") + (rename-file "sntp/libevent:build-aux" + "sntp/libevent/build-aux"))))) + (native-inputs (list which pkg-config)) + (inputs (cons* openssl libevent + ;; Build with POSIX capabilities support on GNU/Linux. This allows + ;; 'ntpd' to run as non-root (when invoked with '-u'.) + (if (target-linux?) + (list libcap) + '()))) + (arguments + (list + ;; Pass "--with-yielding-select=yes" so that 'configure' knows whether + ;; 'select' yields when using pthreads in a cross-compilation context. + #:configure-flags + #~(list "--with-yielding-select=yes") + #:phases + #~(modify-phases %standard-phases + (add-after 'unpack 'disable-network-test + (lambda _ + (substitute* "tests/libntp/Makefile.in" + (("test-decodenetnum\\$\\(EXEEXT\\) ") + ""))))))) + (build-system gnu-build-system) + (synopsis "Real time clock synchronization system") + (description "NTP is a system designed to synchronize the clocks of computers over a network.") - (license (l:x11-style - "https://www.eecis.udel.edu/~mills/ntp/html/copyright.html" - "A non-copyleft free licence from the University of Delaware")) - (home-page "https://www.ntp.org"))) + (license (l:x11-style + "https://www.eecis.udel.edu/~mills/ntp/html/copyright.html" + "A non-copyleft free licence from the University of Delaware")) + (home-page "https://www.ntp.org"))) (define-public openntpd (package diff --git a/gnu/packages/patches/ntp-fix-dereferencing-the-wrong-variable.patch b/gnu/packages/patches/ntp-fix-dereferencing-the-wrong-variable.patch new file mode 100644 index 0000000000..96108d2d83 --- /dev/null +++ b/gnu/packages/patches/ntp-fix-dereferencing-the-wrong-variable.patch @@ -0,0 +1,45 @@ +Subject: [PATCH] Fix dereferencing the wrong variable + +In line 1911 in ntp_io.c, the code calls `create_interface(port, ep2)` and saves +the return value in the variable `ep`, which is then checked to not be `NULL` in +the next line. In case `ep` is `NULL`, the code starting in line 1923 is +executed. Keep in mind that `ep` is `NULL` in this branch. The error is logged +in line 1928 and the address inside `ep` is converted using `stoa` by calling +`stoa(&ep->sin)`. This would normally be fine since `socktoa` catches a `NULL` +pointer in line 43 in socktoa.c but `&ep->sin` isn't `NULL` but 0x24 as the +field isn't the first one in the `endpt` struct. + +This then causes a segmentation fault by dereferencing the pointer `0x24` in +line 46 as the code tries to get the address family using `AF(sock)`. + +This only happens when ntpd cannot create an interface which seems to happen at +boot time leading to 6 crashes on my machine on average. + +The issue is that someone accidentally typed `ep` instead of the correct `ep2`. + +This bug is being tracked as 3968 and 3928 upstream. +--- + ntpd/ntp_io.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/ntpd/ntp_io.c b/ntpd/ntp_io.c +index 9d79fe4..0e761ff 100644 +--- a/ntpd/ntp_io.c ++++ b/ntpd/ntp_io.c +@@ -1921,11 +1921,11 @@ update_interfaces( + } + 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.48.1 +