Source-Changes-HG archive

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

[src/trunk]: src/sys/uvm When ubc_alloc() reuses a cached mapping window remo...



details:   https://anonhg.NetBSD.org/src/rev/03934ee02b3e
branches:  trunk
changeset: 766157:03934ee02b3e
user:      hannken <hannken%NetBSD.org@localhost>
date:      Fri Jun 17 09:50:52 2011 +0000

description:
When ubc_alloc() reuses a cached mapping window remove the object from
the lists AFTER clearing its mapping.

Removes a race where uvm_obj_destroy() sees an empty uo_ubc list and
destroys the object before ubc_alloc() gets the objects lock to clear
the mapping.

diffstat:

 sys/uvm/uvm_bio.c |  8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (36 lines):

diff -r b20a68851877 -r 03934ee02b3e sys/uvm/uvm_bio.c
--- a/sys/uvm/uvm_bio.c Fri Jun 17 09:15:24 2011 +0000
+++ b/sys/uvm/uvm_bio.c Fri Jun 17 09:50:52 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_bio.c,v 1.74 2011/06/16 09:21:03 hannken Exp $     */
+/*     $NetBSD: uvm_bio.c,v 1.75 2011/06/17 09:50:52 hannken Exp $     */
 
 /*
  * Copyright (c) 1998 Chuck Silvers.
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_bio.c,v 1.74 2011/06/16 09:21:03 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_bio.c,v 1.75 2011/06/17 09:50:52 hannken Exp $");
 
 #include "opt_uvmhist.h"
 #include "opt_ubc.h"
@@ -507,8 +507,6 @@
                 */
 
                if (oobj != NULL) {
-                       LIST_REMOVE(umap, hash);
-                       LIST_REMOVE(umap, list);
                        if (umap->flags & UMAP_MAPPING_CACHED) {
                                umap->flags &= ~UMAP_MAPPING_CACHED;
                                mutex_enter(oobj->vmobjlock);
@@ -517,6 +515,8 @@
                                pmap_update(pmap_kernel());
                                mutex_exit(oobj->vmobjlock);
                        }
+                       LIST_REMOVE(umap, hash);
+                       LIST_REMOVE(umap, list);
                } else {
                        KASSERT((umap->flags & UMAP_MAPPING_CACHED) == 0);
                }



Home | Main Index | Thread Index | Old Index