diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2016-10-31 19:45:30 +0100 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2016-10-31 19:45:30 +0100 |
commit | 64a2434c9d6bc177df6f20ac42c0fd26fb2ba3b9 (patch) | |
tree | bac62cc1be5b8750821a0de28ee1d37c9e480a85 | |
parent | f6c9a501febff628fe542ee17ab3d789a4de2ac1 (diff) | |
download | gnumach-64a2434c9d6bc177df6f20ac42c0fd26fb2ba3b9.tar.gz gnumach-64a2434c9d6bc177df6f20ac42c0fd26fb2ba3b9.tar.bz2 gnumach-64a2434c9d6bc177df6f20ac42c0fd26fb2ba3b9.zip |
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.c | 10 |
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))) { |