Module Name: src
Committed By: chs
Date: Tue May 30 17:09:17 UTC 2017
Modified Files:
src/sys/uvm: uvm_aobj.c uvm_map.c
Log Message:
add assertions that would have caught the recent audio mmap bugs.
To generate a diff of this commit:
cvs rdiff -u -r1.124 -r1.125 src/sys/uvm/uvm_aobj.c
cvs rdiff -u -r1.350 -r1.351 src/sys/uvm/uvm_map.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/uvm/uvm_aobj.c
diff -u src/sys/uvm/uvm_aobj.c:1.124 src/sys/uvm/uvm_aobj.c:1.125
--- src/sys/uvm/uvm_aobj.c:1.124 Thu Jul 28 07:52:06 2016
+++ src/sys/uvm/uvm_aobj.c Tue May 30 17:09:17 2017
@@ -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 @@ uao_detach(struct uvm_object *uobj)
* 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);
Index: src/sys/uvm/uvm_map.c
diff -u src/sys/uvm/uvm_map.c:1.350 src/sys/uvm/uvm_map.c:1.351
--- src/sys/uvm/uvm_map.c:1.350 Tue May 23 22:18:17 2017
+++ src/sys/uvm/uvm_map.c Tue May 30 17:09:17 2017
@@ -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 @@ uvm_unmap1(struct vm_map *map, vaddr_t s
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...