u64
svm_get_global_region_base_va ()
{
-#ifdef CLIB_SANITIZE_ADDR
- return 0x200000000000;
-#endif
-
#if __aarch64__
/* On AArch64 VA space can have different size, from 36 to 48 bits.
Here we are trying to detect VA bits by parsing /proc/self/maps
clib_unix_error ("unexpected va bits '%u'", bits);
#endif
+#ifdef CLIB_SANITIZE_ADDR
+ return 0x200000000000;
+#endif
/* default value */
return 0x130000000ULL;
}
return -3;
}
close (fd);
- CLIB_MEM_UNPOISON (rp->data_base, map_size);
+ clib_mem_unpoison (rp->data_base, map_size);
rp->backing_file = (char *) format (0, "%s%c", a->backing_file, 0);
rp->flags |= SVM_FLAGS_FILE;
}
return -3;
}
close (fd);
- CLIB_MEM_UNPOISON (rp->data_base, map_size);
+ clib_mem_unpoison (rp->data_base, map_size);
}
return 0;
}
return (0);
}
close (svm_fd);
- CLIB_MEM_UNPOISON (rp, a->size);
+ clib_mem_unpoison (rp, a->size);
svm_region_init_mapped_region (a, rp);
return (0);
}
- CLIB_MEM_UNPOISON (rp, MMAP_PAGESIZE);
+ clib_mem_unpoison (rp, MMAP_PAGESIZE);
/*
* We lost the footrace to create this region; make sure
close (svm_fd);
- CLIB_MEM_UNPOISON (rp, a->size);
+ clib_mem_unpoison (rp, a->size);
if ((uword) rp != rp->virtual_base)
{
pid_holding_region_lock = rp->mutex_owner_pid;
if (pid_holding_region_lock && kill (pid_holding_region_lock, 0) < 0)
{
+ pthread_mutexattr_t attr;
clib_warning
("region %s mutex held by dead pid %d, tag %d, force unlock",
rp->region_name, pid_holding_region_lock, rp->mutex_owner_tag);
/* owner pid is nonexistent */
- rp->mutex.__data.__owner = 0;
- rp->mutex.__data.__lock = 0;
+ if (pthread_mutexattr_init (&attr))
+ clib_unix_warning ("mutexattr_init");
+ if (pthread_mutexattr_setpshared (&attr, PTHREAD_PROCESS_SHARED))
+ clib_unix_warning ("mutexattr_setpshared");
+ if (pthread_mutex_init (&rp->mutex, &attr))
+ clib_unix_warning ("mutex_init");
dead_region_recovery = 1;
}
oldheap = svm_push_pvt_heap (rp); /* nb vec_delete() in the loop */
/* Remove the caller from the list of mappers */
- CLIB_MEM_UNPOISON (rp->client_pids, vec_bytes (rp->client_pids));
+ clib_mem_unpoison (rp->client_pids, vec_bytes (rp->client_pids));
for (i = 0; i < vec_len (rp->client_pids); i++)
{
if (rp->client_pids[i] == mypid)
virtual_base = root_rp->virtual_base;
virtual_size = root_rp->virtual_size;
- CLIB_MEM_UNPOISON (root_rp->client_pids, vec_bytes (root_rp->client_pids));
+ clib_mem_unpoison (root_rp->client_pids, vec_bytes (root_rp->client_pids));
for (i = 0; i < vec_len (root_rp->client_pids); i++)
{
if (root_rp->client_pids[i] == mypid)
* find_or_create.
*/
/* *INDENT-OFF* */
- pool_foreach (subp, mp->subregions, ({
+ pool_foreach (subp, mp->subregions) {
name = vec_dup (subp->subregion_name);
vec_add1(svm_names, name);
- }));
+ }
/* *INDENT-ON* */
pthread_mutex_unlock (&root_rp->mutex);