mirror of
https://github.com/hashcat/hashcat.git
synced 2025-07-05 06:12:35 +00:00
Fixing race condition involved with SIGINT after signal handler runs.
This commit is contained in:
parent
313bc83804
commit
5995e009aa
@ -54,9 +54,6 @@
|
|||||||
#include "brain.h"
|
#include "brain.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// hashcat_ctx stored globally for signal handling
|
|
||||||
hashcat_ctx_t *hc_ctx;
|
|
||||||
|
|
||||||
// inner2_loop iterates through wordlists, then calls kernel execution
|
// inner2_loop iterates through wordlists, then calls kernel execution
|
||||||
|
|
||||||
static int inner2_loop (hashcat_ctx_t *hashcat_ctx)
|
static int inner2_loop (hashcat_ctx_t *hashcat_ctx)
|
||||||
@ -1095,8 +1092,7 @@ int hashcat_init (hashcat_ctx_t *hashcat_ctx, void (*event) (const u32, struct h
|
|||||||
hashcat_ctx->user_options_extra = (user_options_extra_t *) hcmalloc (sizeof (user_options_extra_t));
|
hashcat_ctx->user_options_extra = (user_options_extra_t *) hcmalloc (sizeof (user_options_extra_t));
|
||||||
hashcat_ctx->user_options = (user_options_t *) hcmalloc (sizeof (user_options_t));
|
hashcat_ctx->user_options = (user_options_t *) hcmalloc (sizeof (user_options_t));
|
||||||
hashcat_ctx->wl_data = (wl_data_t *) hcmalloc (sizeof (wl_data_t));
|
hashcat_ctx->wl_data = (wl_data_t *) hcmalloc (sizeof (wl_data_t));
|
||||||
|
|
||||||
hc_ctx = hashcat_ctx;
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,6 +28,9 @@
|
|||||||
int _dowildcard = -1;
|
int _dowildcard = -1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// hashcat_ctx stored globally for signal handling
|
||||||
|
hashcat_ctx_t *hc_ctx;
|
||||||
|
|
||||||
static void main_log_clear_line (MAYBE_UNUSED const size_t prev_len, MAYBE_UNUSED FILE *fp)
|
static void main_log_clear_line (MAYBE_UNUSED const size_t prev_len, MAYBE_UNUSED FILE *fp)
|
||||||
{
|
{
|
||||||
if (!is_stdout_terminal ()) return;
|
if (!is_stdout_terminal ()) return;
|
||||||
@ -1284,6 +1287,10 @@ int main (int argc, char **argv)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Initializing the hashcat ctx global pointer for the signal handler
|
||||||
|
|
||||||
|
hc_ctx = hashcat_ctx;
|
||||||
|
|
||||||
// init a hashcat session; this initializes backend devices, hwmon, etc
|
// init a hashcat session; this initializes backend devices, hwmon, etc
|
||||||
|
|
||||||
welcome_screen (hashcat_ctx, VERSION_TAG);
|
welcome_screen (hashcat_ctx, VERSION_TAG);
|
||||||
|
16
src/thread.c
16
src/thread.c
@ -92,16 +92,24 @@ void hc_signal (BOOL WINAPI (callback) (DWORD))
|
|||||||
|
|
||||||
void sigHandler_default (int sig)
|
void sigHandler_default (int sig)
|
||||||
{
|
{
|
||||||
myabort (hc_ctx);
|
if (hc_ctx)
|
||||||
|
{
|
||||||
|
hc_ctx = NULL;
|
||||||
|
myabort (hc_ctx);
|
||||||
|
}
|
||||||
|
|
||||||
signal (sig, NULL);
|
// signal (sig, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void sigHandler_benchmark (int sig)
|
void sigHandler_benchmark (int sig)
|
||||||
{
|
{
|
||||||
myquit (hc_ctx);
|
if (hc_ctx)
|
||||||
|
{
|
||||||
|
hc_ctx = NULL;
|
||||||
|
myquit (hc_ctx);
|
||||||
|
}
|
||||||
|
|
||||||
signal (sig, NULL);
|
// signal (sig, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void hc_signal (void (callback) (int))
|
void hc_signal (void (callback) (int))
|
||||||
|
Loading…
Reference in New Issue
Block a user