Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unsafe reads of the av_entry_pool because the util_av implementation does not require a lock to be held in some cases #10804

Open
sunkuamzn opened this issue Feb 20, 2025 · 0 comments

Comments

@sunkuamzn
Copy link
Contributor

The util_av implementation requires a mutex (will be a genlock after #10803) to be held for when writing to the av_entry_pool

assert(ofi_mutex_held(&av->lock));

assert(ofi_mutex_held(&av->lock));

assert(ofi_mutex_held(&av->lock));

but not when reading from the av_entry_pool

void *ofi_av_get_addr(struct util_av *av, fi_addr_t fi_addr)
{
struct util_av_entry *entry;
entry = ofi_bufpool_get_ibuf(av->av_entry_pool, fi_addr);
return entry->data;
}

size_t ofi_av_size(struct util_av *av)
{
return av->av_entry_pool->entry_cnt ?
av->av_entry_pool->entry_cnt :
av->av_entry_pool->attr.chunk_cnt;
}

except for ofi_av_lookup_fi_addr

ofi_mutex_lock(&av->lock);
fi_addr = ofi_av_lookup_fi_addr_unsafe(av, addr);
ofi_mutex_unlock(&av->lock);

SHM, SM2 (and maybe other providers) are performing unsafe reads of the av_entry_pool

id = smr_addr_lookup(ep->util_ep.av, fi_addr);

id = smr_addr_lookup(util_av, fi_addr);

*gid = *((sm2_gid_t *) ofi_av_get_addr(ep->util_ep.av, fi_addr));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant