Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-7-0]: src/sys/kern Pull up following revision(s) (requested by ma...



details:   https://anonhg.NetBSD.org/src/rev/cbd1ea6a1781
branches:  netbsd-7-0
changeset: 801551:cbd1ea6a1781
user:      martin <martin%NetBSD.org@localhost>
date:      Fri Feb 01 11:12:03 2019 +0000

description:
Pull up following revision(s) (requested by maxv in ticket #1678):

        sys/kern/kern_time.c: revision 1.190
        sys/kern/kern_time.c: revision 1.194

Fix stack info leak. There are 4 bytes of padding in struct timeval. Looks
like there are other leaks related to timeval in this file.

[  133.414352] kleak: Possible leak in copyout: [len=16, leaked=4]
[  133.414352] #0 0xffffffff80224d0a in kleak_note <netbsd>
[  133.424360] #1 0xffffffff80224d8a in kleak_copyout <netbsd>
[  133.434361] #2 0xffffffff80b5fd79 in sys___gettimeofday50 <netbsd>
[  133.434361] #3 0xffffffff8025a89c in sy_call <netbsd>
[  133.444351] #4 0xffffffff8025aace in sy_invoke <netbsd>
[  133.454365] #5 0xffffffff8025ab54 in syscall <netbsd>

 -

Fix kernel info leaks.

diffstat:

 sys/kern/kern_time.c |  6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diffs (34 lines):

diff -r 002e51968551 -r cbd1ea6a1781 sys/kern/kern_time.c
--- a/sys/kern/kern_time.c      Wed Jan 30 13:33:34 2019 +0000
+++ b/sys/kern/kern_time.c      Fri Feb 01 11:12:03 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_time.c,v 1.179.12.4 2018/12/27 12:01:50 martin Exp $      */
+/*     $NetBSD: kern_time.c,v 1.179.12.5 2019/02/01 11:12:03 martin Exp $      */
 
 /*-
  * Copyright (c) 2000, 2004, 2005, 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_time.c,v 1.179.12.4 2018/12/27 12:01:50 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_time.c,v 1.179.12.5 2019/02/01 11:12:03 martin Exp $");
 
 #include <sys/param.h>
 #include <sys/resourcevar.h>
@@ -388,6 +388,7 @@
        struct timezone tzfake;
 
        if (SCARG(uap, tp)) {
+               memset(&atv, 0, sizeof(atv));
                microtime(&atv);
                error = copyout(&atv, SCARG(uap, tp), sizeof(atv));
                if (error)
@@ -487,6 +488,7 @@
        extern int64_t time_adjtime;  /* in kern_ntptime.c */
 
        if (olddelta) {
+               memset(olddelta, 0, sizeof(*olddelta));
                mutex_spin_enter(&timecounter_lock);
                olddelta->tv_sec = time_adjtime / 1000000;
                olddelta->tv_usec = time_adjtime % 1000000;



Home | Main Index | Thread Index | Old Index