blob: d7e41c31e6cda75155b1fa8a1374882c51c1f2ea (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
From 567df96ae1f966f3edc02f5296fcb250b6b0a841 Mon Sep 17 00:00:00 2001
From: Justus Winter <4winter@informatik.uni-hamburg.de>
Date: Sun, 16 Aug 2015 15:16:57 +0200
Subject: [PATCH gnumach 10/12] fu_locking_issues
---
vm/vm_map.c | 22 +++++++++++++++++-----
1 file changed, 17 insertions(+), 5 deletions(-)
diff --git a/vm/vm_map.c b/vm/vm_map.c
index a26eaff..d4ae0f1 100644
--- a/vm/vm_map.c
+++ b/vm/vm_map.c
@@ -2126,6 +2126,7 @@ start_pass_1:
for (entry = tmp_entry;;) {
vm_size_t sub_size = (entry->vme_end - entry->vme_start);
vm_map_entry_t next = entry->vme_next;
+ vm_object_t object;
if ( ! (entry->protection & VM_PROT_WRITE)) {
vm_map_unlock(dst_map);
@@ -2161,10 +2162,13 @@ start_pass_1:
/*
* Check for permanent objects in the destination.
*/
-
- if ((entry->object.vm_object != VM_OBJECT_NULL) &&
- !entry->object.vm_object->temporary)
- contains_permanent_objects = TRUE;
+ object = entry->object.vm_object;
+ if ((object != VM_OBJECT_NULL)
+ && ! contains_permanent_objects) {
+ vm_object_lock(object);
+ contains_permanent_objects = object->temporary;
+ vm_object_unlock(object);
+ }
size -= sub_size;
entry = next;
@@ -2224,6 +2228,7 @@ start_pass_1:
vm_map_entry_t copy_entry = vm_map_copy_first_entry(copy);
vm_size_t copy_size = (copy_entry->vme_end - copy_entry->vme_start);
vm_object_t object;
+ int temporary;
entry = tmp_entry;
size = (entry->vme_end - entry->vme_start);
@@ -2279,8 +2284,15 @@ start_pass_1:
*/
object = entry->object.vm_object;
+ temporary = 0;
+ if (object != VM_OBJECT_NULL) {
+ vm_object_lock(object);
+ temporary = object->temporary;
+ vm_object_unlock(object);
+ }
+
if (!entry->is_shared &&
- ((object == VM_OBJECT_NULL) || object->temporary)) {
+ ((object == VM_OBJECT_NULL) || temporary)) {
vm_object_t old_object = entry->object.vm_object;
vm_offset_t old_offset = entry->offset;
--
2.1.4
|