Source-Changes-HG archive

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

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



details:   https://anonhg.NetBSD.org/src/rev/a11f1df17ebd
branches:  netbsd-7-1
changeset: 800964:a11f1df17ebd
user:      martin <martin%NetBSD.org@localhost>
date:      Fri Feb 01 11:08:56 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 c956d06d27d7 -r a11f1df17ebd sys/kern/kern_time.c
--- a/sys/kern/kern_time.c      Wed Jan 30 13:30:16 2019 +0000
+++ b/sys/kern/kern_time.c      Fri Feb 01 11:08:56 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_time.c,v 1.179.8.1.4.3 2018/12/27 12:01:06 martin Exp $   */
+/*     $NetBSD: kern_time.c,v 1.179.8.1.4.4 2019/02/01 11:08:56 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.8.1.4.3 2018/12/27 12:01:06 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_time.c,v 1.179.8.1.4.4 2019/02/01 11:08:56 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