summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2016-10-31 19:45:30 +0100
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2016-10-31 19:45:30 +0100
commit64a2434c9d6bc177df6f20ac42c0fd26fb2ba3b9 (patch)
treebac62cc1be5b8750821a0de28ee1d37c9e480a85
parentf6c9a501febff628fe542ee17ab3d789a4de2ac1 (diff)
gsync: Fix assertion failure with MACH_LDEBUG
vm_map_lock_read calls check_simple_locks(), so we need to lock hbp after taking the vm_map read lock. * kern/gsync.c (gsync_wait): Call vm_map_lock_read before locking &hbp->lock. (gsync_wake): Likewise.
-rw-r--r--kern/gsync.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/kern/gsync.c b/kern/gsync.c
index 68b3d0b0..d0f609fb 100644
--- a/kern/gsync.c
+++ b/kern/gsync.c
@@ -191,14 +191,14 @@ kern_return_t gsync_wait (task_t task, vm_offset_t addr,
if (unlikely (bucket < 0))
return (KERN_INVALID_ADDRESS);
- struct gsync_hbucket *hbp = gsync_buckets + bucket;
- simple_lock (&hbp->lock);
-
- /* Now test that the address is actually valid for the
+ /* Test that the address is actually valid for the
* given task. Do so with the read-lock held in order
* to prevent memory deallocations. */
vm_map_lock_read (task->map);
+ struct gsync_hbucket *hbp = gsync_buckets + bucket;
+ simple_lock (&hbp->lock);
+
if (unlikely (!valid_access_p (task->map, addr, flags)))
{
simple_unlock (&hbp->lock);
@@ -285,9 +285,9 @@ kern_return_t gsync_wake (task_t task,
kern_return_t ret = KERN_INVALID_ARGUMENT;
+ vm_map_lock_read (task->map);
struct gsync_hbucket *hbp = gsync_buckets + bucket;
simple_lock (&hbp->lock);
- vm_map_lock_read (task->map);
if (unlikely (!valid_access_p (task->map, addr, flags)))
{