Hi, it seems there could be a deadlock due to cyclic lock acquisitions between locks mux_hr and mux_hg in the method brain_server_handle_client executed by multiple concurrent threads. Should it be a bug?
void *brain_server_handle_client (void *p)
{
...;
hc_thread_mutex_lock (brain_server_db_hash->mux_hr);
if (brain_server_db_hash->hb == 1)
{
hc_thread_mutex_lock (brain_server_db_hash->mux_hg); // from lock mux_hr to mux_hg
}
hc_thread_mutex_unlock (brain_server_db_hash->mux_hr);
...;
hc_thread_mutex_lock (brain_server_db_hash->mux_hr); // from mux_hg to mux_hr
...;
if (brain_server_db_hash->hb == 0)
{
hc_thread_mutex_unlock (brain_server_db_hash->mux_hg);
}
hc_thread_mutex_unlock (brain_server_db_hash->mux_hr);
...;
}
|
hc_thread_mutex_lock (brain_server_db_hash->mux_hr); |
|
|
|
brain_server_db_hash->hb--; |
|
|
|
if (brain_server_db_hash->hb == 0) |
|
{ |
|
hc_thread_mutex_unlock (brain_server_db_hash->mux_hg); |
|
} |
|
|
|
hc_thread_mutex_unlock (brain_server_db_hash->mux_hr); |
|
hc_thread_mutex_lock (brain_server_db_hash->mux_hr); |
|
|
|
brain_server_db_hash->hb++; |
|
|
|
if (brain_server_db_hash->hb == 1) |
|
{ |
|
hc_thread_mutex_lock (brain_server_db_hash->mux_hg); |
|
} |
|
|
|
hc_thread_mutex_unlock (brain_server_db_hash->mux_hr); |
|
hc_thread_create (client_thr, brain_server_handle_client, &brain_server_client_options[client_idx]); |
Best,
Hi, it seems there could be a deadlock due to cyclic lock acquisitions between locks mux_hr and mux_hg in the method brain_server_handle_client executed by multiple concurrent threads. Should it be a bug?
hashcat/src/brain.c
Lines 2811 to 2820 in 959a232
hashcat/src/brain.c
Lines 2770 to 2779 in 959a232
hashcat/src/brain.c
Line 3316 in 959a232
Best,