From nobody Fri Feb 28 16:22:56 2025 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z4D5b4W36z5nfyj for ; Fri, 28 Feb 2025 16:22:59 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from omta003.cacentral1.a.cloudfilter.net (omta001.cacentral1.a.cloudfilter.net [3.97.99.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z4D5b1W2zz43cX; Fri, 28 Feb 2025 16:22:59 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Authentication-Results: mx1.freebsd.org; none Received: from shw-obgw-4001a.ext.cloudfilter.net ([10.228.9.142]) by cmsmtp with ESMTPS id nyaHtWsyt9JM2o38ctaJpR; Fri, 28 Feb 2025 16:22:58 +0000 Received: from spqr.komquats.com ([70.66.136.217]) by cmsmtp with ESMTPSA id o38btcTK04k0oo38btIv8r; Fri, 28 Feb 2025 16:22:58 +0000 X-Auth-User: cschuber X-Authority-Analysis: v=2.4 cv=fLKa3oae c=1 sm=1 tr=0 ts=67c1e2e2 a=h7br+8Ma+Xn9xscxy5znUg==:117 a=h7br+8Ma+Xn9xscxy5znUg==:17 a=R3mQYeSd_XdQyng2:21 a=kj9zAlcOel0A:10 a=T2h4t0Lz3GQA:10 a=6I5d2MoRAAAA:8 a=85N1-lAfAAAA:8 a=EkcXrb_YAAAA:8 a=YxBL1-UpAAAA:8 a=GtMiImJ-MpWkFAqZ9TAA:9 a=CjuIK1q_8ugA:10 a=cyfSibbquD4hpIoiQNSb:22 a=LK5xJRSDVpKd5WXXoEvA:22 a=Ia-lj3WSrqcvXOmTRaiG:22 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTP id EB59D489; Fri, 28 Feb 2025 08:22:56 -0800 (PST) Received: by slippy.cwsent.com (Postfix, from userid 1000) id EA1C73A4; Fri, 28 Feb 2025 08:22:56 -0800 (PST) X-Mailer: exmh version 2.9.0 11/07/2018 with nmh-1.8+dev Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: Tomoaki AOKI cc: Cy Schubert , dev-commits-src-branches@freebsd.org Subject: Re: git: 1a241a911dc8 - stable/14 - ntpd: Use the ntpd -u option in preference to the rc su plumbing In-reply-to: <20250228185324.df32beaa550475b0832e1ca0@dec.sakura.ne.jp> References: <20250228185324.df32beaa550475b0832e1ca0@dec.sakura.ne.jp> Comments: In-reply-to Tomoaki AOKI message dated "Fri, 28 Feb 2025 18:53:24 +0900." List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Fri, 28 Feb 2025 08:22:56 -0800 Message-Id: <20250228162256.EA1C73A4@slippy.cwsent.com> X-CMAE-Envelope: MS4xfMMVkgLK7GtQQJ9UR9N0vI2uwNB9RIot90PO0UVZcK9OiPI5u1s2hXGGIXp2FOXVT5w+1pCNQcDoEgAQCyY7aqNItF24vt+pFTIOorOAA2p0sDzpyvvE ZRob6OnKTQkn+mwUPuUKGLIrS2aQodf4jjrZVsxwe51+Dh4NcyMO0mZ27VNK6dGIfc0NkioVuiKb1Wl8mNtP8VbwZgFoQ+eEdVwMzc4U9FeygNLiULvsFsga sw22fKYwsXdeqM90VeSHdrmgTtCflWX41J4x/xUPeElACR3zbCWtq7uN0ZB7Z/Qw X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:16509, ipnet:3.96.0.0/15, country:US] X-Rspamd-Queue-Id: 4Z4D5b1W2zz43cX X-Spamd-Bar: ---- In message <20250228185324.df32beaa550475b0832e1ca0@dec.sakura.ne.jp>, Tomoaki AOKI writes: > Hi. > > Unfortunately, this commit caused ntpd hesitating to (re)start > with error messages below on stable/14, amd64. > > ===== Quote ===== > # service ntpd stop > Stopping ntpd. > Waiting for PIDS: 52508. > # service ntpd start > Starting ntpd. > daemon control: got EOF > /etc/rc.d/ntpd: WARNING: failed to start ntpd > # > ===== End quote ===== > > Note that I have > ntpd_flags="-4 -g -x -f /var/db/ntpd.drift -l /var/log/ntpd.log" > ntpd_config="/etc/ntp/ntp.conf" > ntpd_enable="YES" > ntpd_sync_on_start="YES" > daily_ntpd_leapfile_enable="YES" > ntp_leapfile_fetch_verbose="YES" > in my /etc/rc.conf. > > And the high PID value above is because this output is obtained after > several attempts of stopping and starting. > > Regards. > > > > The branch stable/14 has been updated by cy: > > > > URL: > https://cgit.FreeBSD.org/src/commit/?id=1a241a911dc8635c3803f1a6620e1ab4692f6 > ecf > > > > commit 1a241a911dc8635c3803f1a6620e1ab4692f6ecf > > Author: Cy Schubert > > AuthorDate: 2024-12-12 20:03:09 +0000 > > Commit: Cy Schubert > > CommitDate: 2025-02-25 00:37:46 +0000 > > > > ntpd: Use the ntpd -u option in preference to the rc su plumbing > > > > Using the rc plumbing to setuid(2) is preferred as it allows the > user > > to use the -i option in ntpd_flags to chroot ntpd. > > > > Chrooting ntpd by default will be a 2025 project. > > > > Reviewed by: markj > > Differential Revision: https://reviews.freebsd.org/D48191 > > > > (cherry picked from commit 521f66715afb312b356afafc68cbc044a436a753) > > --- > > libexec/rc/rc.d/ntpd | 9 +++++++-- > > 1 file changed, 7 insertions(+), 2 deletions(-) > > > > diff --git a/libexec/rc/rc.d/ntpd b/libexec/rc/rc.d/ntpd > > index 76d83149ae1a..36df4ae08c96 100755 > > --- a/libexec/rc/rc.d/ntpd > > +++ b/libexec/rc/rc.d/ntpd > > @@ -98,7 +98,6 @@ ntpd_precmd() > > # by the admin, we don't add the option. If the file exists > in the old > > # default location we use that, else we use the new default > location. > > if can_run_nonroot; then > > - _user="ntpd" > > driftopt="-f ${_ntp_default_driftfile}" > > elif grep -q "^[ \t]*driftfile" "${ntpd_config}" || > > [ -n "${rc_flags}" ] && > > @@ -112,7 +111,13 @@ ntpd_precmd() > > fi > > > > # Set command_args based on the various config vars. > > - command_args="-p ${pidfile} -c ${ntpd_config} ${driftopt}" > > + command_args="-p ${pidfile} -c ${ntpd_config} ${driftopt} -u $ > {ntpd_user:=ntpd:ntpd}" > > + > > + # Unset ntpd_user because rc.subr uses $${name}_user to > determine > > + # whether to invoke su(1) to setuid() to $ntpd_user for us. We > want > > + # ntpd to do the setuid() itself through the -u argument, > above. > > + unset ntpd_user > > + > > if checkyesno ntpd_sync_on_start; then > > command_args="${command_args} -g" > > fi > > -- > Tomoaki AOKI This looks like it's related to, https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=284863, which is upstream https://bugs.ntp.org/show_bug.cgi?id=3967. It's a regression in 4.2.8p18. -- Cheers, Cy Schubert FreeBSD UNIX: Web: https://FreeBSD.org NTP: Web: https://nwtime.org e^(i*pi)+1=0