Source-Changes-HG archive

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

[src/trunk]: src/sys/uvm add assertions that would have caught the recent aud...



details:   https://anonhg.NetBSD.org/src/rev/d7ab5337a68b
branches:  trunk
changeset: 353973:d7ab5337a68b
user:      chs <chs%NetBSD.org@localhost>
date:      Tue May 30 17:09:17 2017 +0000

description:
add assertions that would have caught the recent audio mmap bugs.

diffstat:

 sys/uvm/uvm_aobj.c |  5 +++--
 sys/uvm/uvm_map.c  |  6 ++++--
 2 files changed, 7 insertions(+), 4 deletions(-)

diffs (58 lines):

diff -r b35d4ada9d17 -r d7ab5337a68b sys/uvm/uvm_aobj.c
--- a/sys/uvm/uvm_aobj.c        Tue May 30 13:49:01 2017 +0000
+++ b/sys/uvm/uvm_aobj.c        Tue May 30 17:09:17 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_aobj.c,v 1.124 2016/07/28 07:52:06 martin Exp $    */
+/*     $NetBSD: uvm_aobj.c,v 1.125 2017/05/30 17:09:17 chs Exp $       */
 
 /*
  * Copyright (c) 1998 Chuck Silvers, Charles D. Cranor and
@@ -38,7 +38,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_aobj.c,v 1.124 2016/07/28 07:52:06 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_aobj.c,v 1.125 2017/05/30 17:09:17 chs Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_uvmhist.h"
@@ -590,6 +590,7 @@
         * Drop the reference.  If it was the last one, destroy the object.
         */
 
+       KASSERT(uobj->uo_refs > 0);
        UVMHIST_LOG(maphist,"  (uobj=0x%x)  ref=%d", uobj,uobj->uo_refs,0,0);
        if (atomic_dec_uint_nv(&uobj->uo_refs) > 0) {
                UVMHIST_LOG(maphist, "<- done (rc>0)", 0,0,0,0);
diff -r b35d4ada9d17 -r d7ab5337a68b sys/uvm/uvm_map.c
--- a/sys/uvm/uvm_map.c Tue May 30 13:49:01 2017 +0000
+++ b/sys/uvm/uvm_map.c Tue May 30 17:09:17 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_map.c,v 1.350 2017/05/23 22:18:17 christos Exp $   */
+/*     $NetBSD: uvm_map.c,v 1.351 2017/05/30 17:09:17 chs Exp $        */
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -66,7 +66,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_map.c,v 1.350 2017/05/23 22:18:17 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_map.c,v 1.351 2017/05/30 17:09:17 chs Exp $");
 
 #include "opt_ddb.h"
 #include "opt_pax.h"
@@ -4711,11 +4711,13 @@
        struct vm_map_entry *dead_entries;
        UVMHIST_FUNC("uvm_unmap"); UVMHIST_CALLED(maphist);
 
+       KASSERT(start < end);
        UVMHIST_LOG(maphist, "  (map=%p, start=%#lx, end=%#lx)",
            map, start, end, 0);
        if (map == kernel_map) {
                LOCKDEBUG_MEM_CHECK((void *)start, end - start);
        }
+
        /*
         * work now done by helper functions.   wipe the pmap's and then
         * detach from the dead entries...



Home | Main Index | Thread Index | Old Index