OpenCL Kernels: Abort session if kernel self-test failed

pull/1563/merge
jsteube 6 years ago
parent 215063d0fc
commit 469fece141

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

@ -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;

@ -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);

@ -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;

Loading…
Cancel
Save