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
This commit is contained in:
Ed Schouten 2015-08-04 06:01:13 +00:00
parent a8126b4c70
commit dc4b532479
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=286277

View File

@ -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;