Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/uvm uvmspace_exec(): set VM_MAP_DYING for the duration, ...
details: https://anonhg.NetBSD.org/src/rev/ec5c34dff35a
branches: trunk
changeset: 970999:ec5c34dff35a
user: ad <ad%NetBSD.org@localhost>
date: Fri Apr 10 17:26:46 2020 +0000
description:
uvmspace_exec(): set VM_MAP_DYING for the duration, so pmap_update() is not
called until the pmap has been totally cleared out after pmap_remove_all(),
or it can confuse some pmap implementations.
diffstat:
sys/uvm/uvm_map.c | 23 +++++++++++++++++++----
1 files changed, 19 insertions(+), 4 deletions(-)
diffs (55 lines):
diff -r adf2937afd52 -r ec5c34dff35a sys/uvm/uvm_map.c
--- a/sys/uvm/uvm_map.c Fri Apr 10 17:18:04 2020 +0000
+++ b/sys/uvm/uvm_map.c Fri Apr 10 17:26:46 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uvm_map.c,v 1.377 2020/04/04 21:17:02 ad Exp $ */
+/* $NetBSD: uvm_map.c,v 1.378 2020/04/10 17:26:46 ad 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.377 2020/04/04 21:17:02 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_map.c,v 1.378 2020/04/10 17:26:46 ad Exp $");
#include "opt_ddb.h"
#include "opt_pax.h"
@@ -2266,7 +2266,10 @@
/*
* note: if map is dying, leave pmap_update() for
- * pmap_destroy(), which will be called later.
+ * later. if the map is to be reused (exec) then
+ * pmap_update() will be called. if the map is
+ * being disposed of (exit) then pmap_destroy()
+ * will be called.
*/
if ((map->flags & VM_MAP_DYING) == 0) {
@@ -4167,11 +4170,23 @@
map->flags &= ~VM_MAP_WIREFUTURE;
/*
- * now unmap the old program
+ * now unmap the old program.
+ *
+ * XXX set VM_MAP_DYING for the duration, so pmap_update()
+ * is not called until the pmap has been totally cleared out
+ * after pmap_remove_all(), or it can confuse some pmap
+ * implementations. it would be nice to handle this by
+ * deferring the pmap_update() while it is known the address
+ * space is not visible to any user LWP other than curlwp,
+ * but there isn't an elegant way of inferring that right
+ * now.
*/
flags = pmap_remove_all(map->pmap) ? UVM_FLAG_VAONLY : 0;
+ map->flags |= VM_MAP_DYING;
uvm_unmap1(map, vm_map_min(map), vm_map_max(map), flags);
+ map->flags &= ~VM_MAP_DYING;
+ pmap_update(map->pmap);
KASSERT(map->header.prev == &map->header);
KASSERT(map->nentries == 0);
Home |
Main Index |
Thread Index |
Old Index