NetBSD Problem Report #15519

Received: (qmail 12587 invoked from network); 7 Feb 2002 10:29:48 -0000
Message-Id: <200202071029.g17ATXo28070@Plectere.com>
Date: Thu, 7 Feb 2002 02:29:33 -0800 (PST)
From: paul@Plectere.com
Reply-To: paul@Plectere.com
To: gnats-bugs@gnats.netbsd.org
Subject: support for chroot'd "ntpd" incomplete
X-Send-Pr-Version: 3.95

>Number:         15519
>Category:       kern
>Synopsis:       support for chroot'd "ntpd" incomplete
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    manu
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Feb 07 10:30:00 +0000 2002
>Closed-Date:    Mon Mar 04 06:04:04 +0000 2002
>Last-Modified:  Mon Mar 04 06:04:04 +0000 2002
>Originator:     Paul Shupak
>Release:        NetBSD 1.5ZA -- current, today
>Organization:

>Environment:
	kernel w/ "pseudo-device clockctl" & "options NTP"
System: NetBSD svcs 1.5ZA NetBSD 1.5ZA (PCOM-$Revision: 1.24 $) #185: Wed Feb 6 22:35:17 PST 2002 paul@svcs:/usr/src/sys/arch/i386/compile/PCOM i386
Architecture: i386
Machine: i386
>Description:
	The ioctl call made in libc's ntp_adjtime() is actually unimplimented.
>How-To-Repeat:
	verify by runing a kernel with "options NTP" and
	"pseudo-device clockctl" and watch time `jump' instead
	of `skew'.  Or, run ntpdc's "kerninfo" command and look at
	error messages ( EINVAL returned from ntp_adjtime() ) and/or
	/var/log/messages.
>Fix:
--- /sys/dev/clockctl.c	Sun Dec  9 22:08:54 2001
+++ clockctl.c	Wed Feb  6 23:19:37 2002
@@ -33,6 +33,8 @@
 #include <sys/cdefs.h>
 __KERNEL_RCSID(0, "$NetBSD: clockctl.c,v 1.4 2001/12/09 16:10:43 manu Exp $");

+#include "opt_ntp.h"
+
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/proc.h>
@@ -125,7 +127,7 @@
 			struct clockctl_ntp_adjtime_args *args =
 			    (struct clockctl_ntp_adjtime_args *)data;

-			(void*)ntp_adjtime1(SCARG(args.uas,tp), &error);
+			(void) ntp_adjtime1(SCARG(args,uas.tp), args, &error);
 			return (error);	
 		}
 #endif /* NTP */
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: kern-bug-people->manu 
Responsible-Changed-By: lukem 
Responsible-Changed-When: Sun Feb 24 19:10:01 PST 2002 
Responsible-Changed-Why:  
manu is responsible for this code 
State-Changed-From-To: open->feedback 
State-Changed-By: manu 
State-Changed-When: Mon Feb 25 13:26:04 PST 2002 
State-Changed-Why:  
submitted patch was comitted 

From: manu@netbsd.org (Emmanuel Dreyfus)
To: paul@Plectere.com (Paul Shupak)
Cc: gnats-bugs@netbsd.org
Subject: Re: kern/15519
Date: Sat, 2 Mar 2002 00:01:11 +0100

 >       Once you enable the code, immediately the compile dies -- wrong number
 > of arguments to the called function.  Looks like either a typo or porting
 > change ( from some other BSD maybe ) that went uncompleted.

 No, the code have been developped on NetBSD, so it is not a porting
 issue. 

 Additionnaly, there is another bug: we do not copyin() the struct ntv
 (first arg to ntp_adjtime1()), and it is a userland address. It seems it
 just work on i386, but on macppc, it immediatly panics the kernel.

 And we don't handle correctly the return value. I've committed a fix to
 theses two problems, please let me know if things are still okay for
 you.

 In fact theses problems reminds me some bug fixes I did. I'm now
 convinced that I forgot to commit some work on sys/dev/clockctl.c a few
 weeks ago.

 -- 
 Emmanuel Dreyfus
 manu@netbsd.org

From: Paul Shupak <paul@Plectere.com>
To: manu@netbsd.org
Cc: gnats-bugs@netbsd.org
Subject: Re: kern/15519
Date: Sun, 3 Mar 2002 14:35:20 -0800 (PST)

 	I think the return/errno issue is somewhat of a red-herring;  The
 return values for ntp_adjtime other than zero are inconsistent across
 different platforms, so most programs only check for zero/non-zero or
 zero/less-than-zero ( i.e. what would be "TIME_OK" in <sys/timex.h> ) :
 Because the return was always zero AND the kernel clock/PLL code really
 was working correctly, the userland code never had a problem with not
 receiving notification of errors ( which hadn't actually occurred ).
 The only code, in the NetBSD tree, which seems to use the leap-seconds'
 return values was in the ref_clock in ntpd.

 	Anyway...  Everything seems to be working just fine (after three
 days on five machines) and certainly the original bug report (kern/15519)
 should be closed.

 	Thanks again,

 	Paul Shupak

 >From manu@netbsd.org Sat Mar  2 01:18:53 2002
 >To: paul@Plectere.com (Paul Shupak)
 >In-Reply-To: <200203020023.g220NdM00504@Plectere.com>
 >Subject: Re: kern/15519
 >From: manu@netbsd.org (Emmanuel Dreyfus)
 >Date: Sat, 2 Mar 2002 10:18:34 +0100
 >MIME-Version: 1.0
 >Content-Type: text/plain; charset=ISO-8859-1
 >X-Mailer: MacSOUP 2.3
 >Content-Transfer-Encoding: 8bit
 >X-MIME-Autoconverted: from quoted-printable to 8bit by Plectere.com id g229Ir410409
 >
 >>       Sorry, I feel quite stupid for not even considuring the "copyin".
 >> Anyway,o far the machines I've tried seem to act identically ( one
 >> Athalon/Via-KX, one Celeron/i810 and a large memory PIII/Via-69x ).
 >
 >They are all i386, this is why. It seems okay to handle directly data
 >outside kernel space on this arch... 
 >What surprises me a lot is that you did not have any problem with the
 >return value missing (it was copied to errno, and ntp_adjtime was always
 >returning 0)
 >
 >Anyway, thank you for digging this out. Feel free to send something to
 >gnats saying that we can close the PR once you'll have tested it for a
 >few days. And thank you also for using this feature.
 >
 >-- 
 >Emmanuel Dreyfus.  
 >Vous avez deplacé la souris. 
 >Windows NT doit maintenant redemarrer pour valider les modifications.
 >manu@netbsd.org
 >
State-Changed-From-To: feedback->closed 
State-Changed-By: manu 
State-Changed-When: Sun Mar 3 22:02:36 PST 2002 
State-Changed-Why:  
The problem is fixed 
>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.