1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-12-23 07:08:19 +00:00

OpenCL Kernels: Abort session if kernel self-test failed

This commit is contained in:
jsteube 2018-06-13 12:22:54 +02:00
parent 215063d0fc
commit 469fece141
4 changed files with 52 additions and 2 deletions

View File

@ -1,5 +1,11 @@
* changes v4.1.0 -> v4.1.1
##
## Improvements
##
- OpenCL Kernels: Abort session if kernel self-test failed
##
## Bugs
##

View File

@ -155,6 +155,14 @@ typedef enum vendor_id
} vendor_id_t;
typedef enum st_status_rc
{
ST_STATUS_PASSED = 0,
ST_STATUS_FAILED = 1,
ST_STATUS_IGNORED = 2,
} st_status_t;
typedef enum status_rc
{
STATUS_INIT = 0,
@ -914,6 +922,8 @@ typedef struct hc_device_param
bool skipped;
bool skipped_temp;
st_status_t st_status;
u32 sm_major;
u32 sm_minor;
u32 kernel_exec_timeout;

View File

@ -727,6 +727,29 @@ static int outer_loop (hashcat_ctx_t *hashcat_ctx)
hcfree (selftest_threads);
// check for any selftest failures
for (u32 device_id = 0; device_id < opencl_ctx->devices_cnt; device_id++)
{
if (opencl_ctx->enabled == false) continue;
if (user_options->self_test_disable == true) continue;
hc_device_param_t *device_param = opencl_ctx->devices_param + device_id;
if (device_param->skipped == true) continue;
if (device_param->st_status == ST_STATUS_FAILED)
{
event_log_error (hashcat_ctx, "Aborting session due to kernel self-test failure.");
event_log_warning (hashcat_ctx, "You can use --self-test-disable to override this, but do not report related errors.");
event_log_warning (hashcat_ctx, NULL);
return -1;
}
}
status_ctx->devices_status = STATUS_INIT;
EVENT (EVENT_SELFTEST_FINISHED);

View File

@ -519,9 +519,20 @@ void *thread_selftest (void *p)
const int rc_selftest = selftest (hashcat_ctx, device_param);
if (rc_selftest == -1)
if (user_options->benchmark == true)
{
// we should do something here, tell hashcat main that selftest failed to abort
device_param->st_status = ST_STATUS_IGNORED;
}
else
{
if (rc_selftest == 0)
{
device_param->st_status = ST_STATUS_PASSED;
}
else
{
device_param->st_status = ST_STATUS_FAILED;
}
}
return NULL;