Source-Changes-HG archive

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

[src/netbsd-8]: src/sys/kern Pull up following revision(s) (requested by maxv...



details:   https://anonhg.NetBSD.org/src/rev/8b91cab79787
branches:  netbsd-8
changeset: 448408:8b91cab79787
user:      martin <martin%NetBSD.org@localhost>
date:      Fri Feb 01 11:21:30 2019 +0000

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

        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 a5516f3c05a2 -r 8b91cab79787 sys/kern/kern_time.c
--- a/sys/kern/kern_time.c      Thu Jan 31 06:46:52 2019 +0000
+++ b/sys/kern/kern_time.c      Fri Feb 01 11:21:30 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_time.c,v 1.189.8.3 2018/12/27 12:19:45 martin Exp $       */
+/*     $NetBSD: kern_time.c,v 1.189.8.4 2019/02/01 11:21:30 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.189.8.3 2018/12/27 12:19:45 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_time.c,v 1.189.8.4 2019/02/01 11:21:30 martin Exp $");
 
 #include <sys/param.h>
 #include <sys/resourcevar.h>
@@ -424,6 +424,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)
@@ -523,6 +524,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