Skip to content

Commit faac211

Browse files
committed
Fix create_slab(): set memory pointer after marking it inaccessible
Signed-off-by: Lukasz Dorau <[email protected]>
1 parent a92aa12 commit faac211

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/pool/pool_disjoint.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,17 +110,20 @@ static slab_t *create_slab(bucket_t *bucket) {
110110
// padding at the end of the slab
111111
slab->slab_size = bucket_slab_alloc_size(bucket);
112112

113+
void *slab_mem_ptr = NULL;
113114
// TODO not true
114115
// NOTE: originally slabs memory were allocated without alignment
115116
// with this registering a slab is simpler and doesn't require multimap
116-
res = umfMemoryProviderAlloc(provider, slab->slab_size, 0, &slab->mem_ptr);
117+
res = umfMemoryProviderAlloc(provider, slab->slab_size, 0, &slab_mem_ptr);
117118
if (res != UMF_RESULT_SUCCESS) {
118119
LOG_ERR("allocation of slab data failed!");
119120
goto free_slab;
120121
}
121122

122123
// raw allocation is not available for user so mark it as inaccessible
123-
utils_annotate_memory_inaccessible(slab->mem_ptr, slab->slab_size);
124+
utils_annotate_memory_inaccessible(slab_mem_ptr, slab->slab_size);
125+
126+
utils_atomic_store_release_ptr(&slab->mem_ptr, slab_mem_ptr);
124127

125128
LOG_DEBUG("bucket: %p, slab_size: %zu", (void *)bucket, slab->slab_size);
126129
return slab;

0 commit comments

Comments
 (0)