summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_umtx.c
diff options
context:
space:
mode:
authored <ed@FreeBSD.org>2015-08-04 06:01:13 +0000
committered <ed@FreeBSD.org>2015-08-04 06:01:13 +0000
commit2f1d917e8e5c0e764c567faf565c7329dbe8e334 (patch)
tree1b9eb4205e2002413cf2b62c723fb88c0f9e94dd /sys/kern/kern_umtx.c
parent87f3e906c04461255cdcd793121eedecfcfb5cae (diff)
downloadFreeBSD-src-2f1d917e8e5c0e764c567faf565c7329dbe8e334.zip
FreeBSD-src-2f1d917e8e5c0e764c567faf565c7329dbe8e334.tar.gz
Fix bad arithmetic in umtx_key_get() to compute object offset.
It looks like umtx_key_get() has the addition and subtraction the wrong way around, meaning that it fails to match in certain cases. This causes the cloudlibc unit tests to deadlock in certain cases. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D3287
Diffstat (limited to 'sys/kern/kern_umtx.c')
-rw-r--r--sys/kern/kern_umtx.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/kern/kern_umtx.c b/sys/kern/kern_umtx.c
index cf47291..a40aa5a 100644
--- a/sys/kern/kern_umtx.c
+++ b/sys/kern/kern_umtx.c
@@ -820,8 +820,8 @@ umtx_key_get(const void *addr, int type, int share, struct umtx_key *key)
(share == AUTO_SHARE &&
VM_INHERIT_SHARE == entry->inheritance)) {
key->shared = 1;
- key->info.shared.offset = entry->offset + entry->start -
- (vm_offset_t)addr;
+ key->info.shared.offset = (vm_offset_t)addr -
+ entry->start + entry->offset;
vm_object_reference(key->info.shared.object);
} else {
key->shared = 0;
OpenPOWER on IntegriCloud