Hi, developers, thank you for your checking. The lock threadLocks[myCPU] may not be correctly released if the results->state != MARKER_STATE_START satisfies and the control flow goes to the branch listed below. Finally, the method returns with the unreleased lock. The fix is to insert pthread_mutex_unlock(&threadLocks[myCPU]); before returning.
|
pthread_mutex_lock(&threadLocks[myCPU]); |
|
if (results->state != MARKER_STATE_START) |
int
likwid_markerStopRegion(const char* regionTag)
{
...;
if (use_locks == 1)
{
pthread_mutex_lock(&threadLocks[myCPU]);
}
cpu_id = hashTable_get(tag, &results);
thread_id = getThreadID(cpu_id);
if (results->state != MARKER_STATE_START)
{
fprintf(stderr, "WARN: Stopping an unknown/not-started region %s\n", regionTag);
return -EFAULT;
}
...;
results->state = MARKER_STATE_STOP;
if (use_locks == 1)
{
pthread_mutex_unlock(&threadLocks[myCPU]);
}
return 0;
}
Best,
Hi, developers, thank you for your checking. The lock
threadLocks[myCPU]may not be correctly released if theresults->state != MARKER_STATE_STARTsatisfies and the control flow goes to the branch listed below. Finally, the method returns with the unreleased lock.The fix is to insert pthread_mutex_unlock(&threadLocks[myCPU]);before returning.likwid/src/libperfctr.c
Line 603 in af9e3c5
likwid/src/libperfctr.c
Line 608 in af9e3c5
likwid/src/libperfctr.c
Line 611 in af9e3c5
Best,