Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev When processing ioctl CLOCKCTL_NTP_ADJTIME, set the ...
details: https://anonhg.NetBSD.org/src/rev/db3f3aa29d8d
branches: trunk
changeset: 772444:db3f3aa29d8d
user: apb <apb%NetBSD.org@localhost>
date: Wed Jan 04 13:40:53 2012 +0000
description:
When processing ioctl CLOCKCTL_NTP_ADJTIME, set the return value from
ntp_timestatus instead of leaving it uninitialised, and don't use
copyout(9) because args->retval is in kernel space, not user space.
Previously, running ntpd(8) in unprivileged mode would call
libc ntp_adjtime(), which would open /dev/clockctl and call
ioctl(CLOCKCTL_NTP_ADJTIME), which would fail with EFAULT.
diffstat:
sys/dev/clockctl.c | 7 +++----
1 files changed, 3 insertions(+), 4 deletions(-)
diffs (35 lines):
diff -r 76d24cf1f468 -r db3f3aa29d8d sys/dev/clockctl.c
--- a/sys/dev/clockctl.c Wed Jan 04 13:31:30 2012 +0000
+++ b/sys/dev/clockctl.c Wed Jan 04 13:40:53 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: clockctl.c,v 1.28 2009/10/03 02:01:12 elad Exp $ */
+/* $NetBSD: clockctl.c,v 1.29 2012/01/04 13:40:53 apb Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: clockctl.c,v 1.28 2009/10/03 02:01:12 elad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: clockctl.c,v 1.29 2012/01/04 13:40:53 apb Exp $");
#include "opt_ntp.h"
#include "opt_compat_netbsd.h"
@@ -147,7 +147,6 @@
case CLOCKCTL_NTP_ADJTIME: {
struct clockctl_ntp_adjtime *args = data;
struct timex ntv;
- register_t retval;
error = copyin(args->tp, &ntv, sizeof(ntv));
if (error)
@@ -157,7 +156,7 @@
error = copyout(&ntv, args->tp, sizeof(ntv));
if (error == 0)
- error = copyout(&retval, &args->retval, sizeof(retval));
+ args->retval = ntp_timestatus();
break;
}
#endif /* NTP */
Home |
Main Index |
Thread Index |
Old Index