Source-Changes-HG archive

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

[src/netbsd-7-0]: src/sys Apply patch, requested by maxv in ticket #1666:



details:   https://anonhg.NetBSD.org/src/rev/a238aa8ab926
branches:  netbsd-7-0
changeset: 446932:a238aa8ab926
user:      martin <martin%NetBSD.org@localhost>
date:      Tue Dec 25 11:34:14 2018 +0000

description:
Apply patch, requested by maxv in ticket #1666:
Fix similar to:

        sys/uvm/uvm_swap.c: revision 1.178

Woah man, fix enormous leak.

        Possible info leak: [len=1056, leaked=931]
        #0 0xffffffff80bad351 in kleak_copyout
        #1 0xffffffff80b2cf64 in uvm_swap_stats.part.1
        #2 0xffffffff80b2d38d in uvm_swap_stats
        #3 0xffffffff80b2d43c in sys_swapctl
        #4 0xffffffff80259b82 in syscall

diffstat:

 sys/compat/netbsd32/netbsd32_netbsd.c |  6 +++---
 sys/uvm/uvm_swap.c                    |  6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diffs (54 lines):

diff -r 0faffb9f658e -r a238aa8ab926 sys/compat/netbsd32/netbsd32_netbsd.c
--- a/sys/compat/netbsd32/netbsd32_netbsd.c     Tue Dec 18 18:37:50 2018 +0000
+++ b/sys/compat/netbsd32/netbsd32_netbsd.c     Tue Dec 25 11:34:14 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: netbsd32_netbsd.c,v 1.193 2014/07/31 12:35:33 maxv Exp $       */
+/*     $NetBSD: netbsd32_netbsd.c,v 1.193.6.1 2018/12/25 11:34:14 martin Exp $ */
 
 /*
  * Copyright (c) 1998, 2001, 2008 Matthew R. Green
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_netbsd.c,v 1.193 2014/07/31 12:35:33 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_netbsd.c,v 1.193.6.1 2018/12/25 11:34:14 martin Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ddb.h"
@@ -1754,7 +1754,7 @@
                count = uvmexp.nswapdev;
 
        ksep_len = sizeof(*ksep) * count;
-       ksep = kmem_alloc(ksep_len, KM_SLEEP);
+       ksep = kmem_zalloc(ksep_len, KM_SLEEP);
        usep32 = (struct netbsd32_swapent *)SCARG(uap, arg);
 
        uvm_swap_stats(SWAP_STATS, ksep, count, retval);
diff -r 0faffb9f658e -r a238aa8ab926 sys/uvm/uvm_swap.c
--- a/sys/uvm/uvm_swap.c        Tue Dec 18 18:37:50 2018 +0000
+++ b/sys/uvm/uvm_swap.c        Tue Dec 25 11:34:14 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_swap.c,v 1.172 2014/07/25 08:10:40 dholland Exp $  */
+/*     $NetBSD: uvm_swap.c,v 1.172.6.1 2018/12/25 11:34:14 martin Exp $        */
 
 /*
  * Copyright (c) 1995, 1996, 1997, 2009 Matthew R. Green
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_swap.c,v 1.172 2014/07/25 08:10:40 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_swap.c,v 1.172.6.1 2018/12/25 11:34:14 martin Exp $");
 
 #include "opt_uvmhist.h"
 #include "opt_compat_netbsd.h"
@@ -515,7 +515,7 @@
                else
 #endif
                        len = sizeof(struct swapent) * misc;
-               sep = (struct swapent *)kmem_alloc(len, KM_SLEEP);
+               sep = (struct swapent *)kmem_zalloc(len, KM_SLEEP);
 
                uvm_swap_stats(SCARG(uap, cmd), sep, misc, retval);
                error = copyout(sep, SCARG(uap, arg), len);



Home | Main Index | Thread Index | Old Index