diff --git a/docs/changes.txt b/docs/changes.txt index fc66d5b9d..f391dd600 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -24,6 +24,7 @@ ## - Fixed building error on Raspberry Pi +- Fixed backend active devices checks - Fixed false negative on Unit Test in case of out-of-memory with grep in single mode - Fixed false negative on Unit Test with hash-type 25400 - Fixed false negative on hash-types 4510 and 4710 for hashes with long salts diff --git a/src/backend.c b/src/backend.c index 186dd9dfb..f370dca28 100644 --- a/src/backend.c +++ b/src/backend.c @@ -153,7 +153,6 @@ static int backend_ctx_find_alias_devices (hashcat_ctx_t *hashcat_ctx) alias_device->skipped = true; backend_ctx->opencl_devices_active--; - backend_ctx->backend_devices_active--; // show a warning for specifically listed devices if they are an alias @@ -7303,6 +7302,9 @@ int backend_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime) if (hc_mtlCreateCommandQueue (hashcat_ctx, device_param->metal_device, &command_queue) == -1) { device_param->skipped = true; + + backend_ctx->metal_devices_active--; + backend_ctx->backend_devices_active--; continue; } @@ -7414,6 +7416,9 @@ int backend_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime) if (hc_clCreateContext (hashcat_ctx, NULL, 1, &device_param->opencl_device, NULL, NULL, &context) == -1) { device_param->skipped = true; + + backend_ctx->opencl_devices_active--; + backend_ctx->backend_devices_active--; continue; } @@ -7426,6 +7431,9 @@ int backend_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime) if (hc_clCreateCommandQueue (hashcat_ctx, context, device_param->opencl_device, 0, &command_queue) == -1) { device_param->skipped = true; + + backend_ctx->opencl_devices_active--; + backend_ctx->backend_devices_active--; continue; } @@ -7612,6 +7620,14 @@ int backend_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime) } } + // check again to catch error on OpenCL/Metal + if (backend_ctx->backend_devices_active == 0) + { + event_log_error (hashcat_ctx, "No devices found/left."); + + return -1; + } + backend_ctx->target_msec = TARGET_MSEC_PROFILE[user_options->workload_profile - 1]; backend_ctx->need_adl = need_adl;