mirror of
https://github.com/hashcat/hashcat
synced 2025-03-26 12:12:43 +01:00
Metal Backend: added workaround to prevent 'Infinite Loop' bug when build kernels
This commit is contained in:
parent
a9d843870d
commit
5f332995bc
@ -77,6 +77,7 @@
|
|||||||
- Unicode: Update UTF-8 to UTF-16 conversion to match RFC 3629
|
- Unicode: Update UTF-8 to UTF-16 conversion to match RFC 3629
|
||||||
- User Options: Added error message when mixing --username and --show to warn users of exponential delay
|
- User Options: Added error message when mixing --username and --show to warn users of exponential delay
|
||||||
- MetaMask: update extraction tool to support MetaMask Mobile wallets
|
- MetaMask: update extraction tool to support MetaMask Mobile wallets
|
||||||
|
- Metal Backend: added workaround to prevent 'Infinite Loop' bug when build kernels
|
||||||
|
|
||||||
* changes v6.2.5 -> v6.2.6
|
* changes v6.2.5 -> v6.2.6
|
||||||
|
|
||||||
|
@ -681,7 +681,8 @@ int hc_mtlCreateCommandQueue (void *hashcat_ctx, mtl_device_id metal_device, mtl
|
|||||||
|
|
||||||
int hc_mtlCreateKernel (void *hashcat_ctx, mtl_device_id metal_device, mtl_library metal_library, const char *func_name, mtl_function *metal_function, mtl_pipeline *metal_pipeline)
|
int hc_mtlCreateKernel (void *hashcat_ctx, mtl_device_id metal_device, mtl_library metal_library, const char *func_name, mtl_function *metal_function, mtl_pipeline *metal_pipeline)
|
||||||
{
|
{
|
||||||
backend_ctx_t *backend_ctx = ((hashcat_ctx_t *) hashcat_ctx)->backend_ctx;
|
backend_ctx_t *backend_ctx = ((hashcat_ctx_t *) hashcat_ctx)->backend_ctx;
|
||||||
|
user_options_t *user_options = ((hashcat_ctx_t *) hashcat_ctx)->user_options;
|
||||||
|
|
||||||
MTL_PTR *mtl = (MTL_PTR *) backend_ctx->mtl;
|
MTL_PTR *mtl = (MTL_PTR *) backend_ctx->mtl;
|
||||||
|
|
||||||
@ -708,7 +709,7 @@ int hc_mtlCreateKernel (void *hashcat_ctx, mtl_device_id metal_device, mtl_libra
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
NSError *error = nil;
|
__block NSError *error = nil;
|
||||||
|
|
||||||
NSString *f_name = [NSString stringWithCString: func_name encoding: NSUTF8StringEncoding];
|
NSString *f_name = [NSString stringWithCString: func_name encoding: NSUTF8StringEncoding];
|
||||||
|
|
||||||
@ -721,6 +722,9 @@ int hc_mtlCreateKernel (void *hashcat_ctx, mtl_device_id metal_device, mtl_libra
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// workaround for MTLCompilerService 'Infinite Loop' bug
|
||||||
|
|
||||||
|
/*
|
||||||
mtl_pipeline mtl_pipe = [metal_device newComputePipelineStateWithFunction: mtl_func error: &error];
|
mtl_pipeline mtl_pipe = [metal_device newComputePipelineStateWithFunction: mtl_func error: &error];
|
||||||
|
|
||||||
if (error != nil)
|
if (error != nil)
|
||||||
@ -729,6 +733,46 @@ int hc_mtlCreateKernel (void *hashcat_ctx, mtl_device_id metal_device, mtl_libra
|
|||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
error = nil;
|
||||||
|
|
||||||
|
__block mtl_pipeline mtl_pipe;
|
||||||
|
|
||||||
|
dispatch_group_t group = dispatch_group_create ();
|
||||||
|
dispatch_queue_t queue = dispatch_get_global_queue (DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
|
||||||
|
|
||||||
|
// wait for 60 secs by default or using user-defined runtime if is set
|
||||||
|
long timeout = (user_options->runtime > 0) ? user_options->runtime : 60;
|
||||||
|
|
||||||
|
dispatch_time_t when = dispatch_time (DISPATCH_TIME_NOW,NSEC_PER_SEC * timeout);
|
||||||
|
|
||||||
|
__block int rc_async_err = 0;
|
||||||
|
|
||||||
|
dispatch_group_async (group, queue, ^(void)
|
||||||
|
{
|
||||||
|
mtl_pipe = [metal_device newComputePipelineStateWithFunction: mtl_func error: &error];
|
||||||
|
|
||||||
|
if (error != nil)
|
||||||
|
{
|
||||||
|
event_log_error (hashcat_ctx, "%s(): failed to create '%s' pipeline, %s", __func__, func_name, [[error localizedDescription] UTF8String]);
|
||||||
|
|
||||||
|
rc_async_err = -1;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
long rc_queue = dispatch_group_wait (group, when);
|
||||||
|
|
||||||
|
dispatch_release (group);
|
||||||
|
|
||||||
|
if (rc_async_err != 0) return -1;
|
||||||
|
|
||||||
|
if (rc_queue != 0)
|
||||||
|
{
|
||||||
|
event_log_error (hashcat_ctx, "%s(): failed to create '%s' pipeline, timeout reached (status %ld)", __func__, func_name, rc_queue);
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
if (mtl_pipe == nil)
|
if (mtl_pipe == nil)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user