Source-Changes-HG archive

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

[src/trunk]: src/sys/kern Fix stack info leak. There are 4 bytes of padding i...



details:   https://anonhg.NetBSD.org/src/rev/8122290b6456
branches:  trunk
changeset: 445746:8122290b6456
user:      maxv <maxv%NetBSD.org@localhost>
date:      Sun Nov 11 11:17:49 2018 +0000

description:
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>

diffstat:

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

diffs (26 lines):

diff -r 301274ebc588 -r 8122290b6456 sys/kern/kern_time.c
--- a/sys/kern/kern_time.c      Sun Nov 11 10:58:40 2018 +0000
+++ b/sys/kern/kern_time.c      Sun Nov 11 11:17:49 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_time.c,v 1.189 2016/11/11 15:29:36 njoly Exp $    */
+/*     $NetBSD: kern_time.c,v 1.190 2018/11/11 11:17:49 maxv 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 2016/11/11 15:29:36 njoly Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_time.c,v 1.190 2018/11/11 11:17:49 maxv 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)



Home | Main Index | Thread Index | Old Index