From 7eee7b7dbc200b0e38a3063d899cf6e3067499ff Mon Sep 17 00:00:00 2001 From: jsteube Date: Sat, 2 Mar 2019 16:21:55 +0100 Subject: [PATCH 1/2] Add some module specific warnings for AMDGPU driver in pure kernel mode --- src/modules/module_01760.c | 17 ++++++++++++++++- src/modules/module_15700.c | 36 ++++++++++++++++++++++++++++++------ src/modules/module_18100.c | 17 ++++++++++++++++- src/modules/module_18200.c | 15 ++++++++++++++- 4 files changed, 76 insertions(+), 9 deletions(-) diff --git a/src/modules/module_01760.c b/src/modules/module_01760.c index f060300d2..f079d2d8b 100644 --- a/src/modules/module_01760.c +++ b/src/modules/module_01760.c @@ -45,6 +45,21 @@ u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } +char *module_jit_build_options (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra, MAYBE_UNUSED const hashes_t *hashes, MAYBE_UNUSED const hc_device_param_t *device_param) +{ + char *jit_build_options = NULL; + + if ((device_param->device_vendor_id == VENDOR_ID_AMD) && (device_param->has_vperm == false)) + { + if ((hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) == 0) + { + hc_asprintf (&jit_build_options, "-cl-opt-disable"); + } + } + + return jit_build_options; +} + int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) { u64 *digest = (u64 *) digest_buf; @@ -194,7 +209,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_hook23 = MODULE_DEFAULT; module_ctx->module_hook_salt_size = MODULE_DEFAULT; module_ctx->module_hook_size = MODULE_DEFAULT; - module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_jit_build_options = module_jit_build_options; module_ctx->module_jit_cache_disable = MODULE_DEFAULT; module_ctx->module_kernel_accel_max = MODULE_DEFAULT; module_ctx->module_kernel_accel_min = MODULE_DEFAULT; diff --git a/src/modules/module_15700.c b/src/modules/module_15700.c index 70f67b92b..7b2524964 100644 --- a/src/modules/module_15700.c +++ b/src/modules/module_15700.c @@ -268,12 +268,36 @@ char *module_jit_build_options (MAYBE_UNUSED const hashconfig_t *hashconfig, MAY char *jit_build_options = NULL; - hc_asprintf (&jit_build_options, "-DSCRYPT_N=%u -DSCRYPT_R=%u -DSCRYPT_P=%u -DSCRYPT_TMTO=%" PRIu64 " -DSCRYPT_TMP_ELEM=%" PRIu64, - hashes->salts_buf[0].scrypt_N, - hashes->salts_buf[0].scrypt_r, - hashes->salts_buf[0].scrypt_p, - scrypt_tmto_final, - tmp_size / 16); + if ((device_param->device_vendor_id == VENDOR_ID_AMD) && (device_param->has_vperm == false)) + { + if ((hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) == 0) + { + hc_asprintf (&jit_build_options, "-D MAYBE_VOLATILE=volatile -DSCRYPT_N=%u -DSCRYPT_R=%u -DSCRYPT_P=%u -DSCRYPT_TMTO=%" PRIu64 " -DSCRYPT_TMP_ELEM=%" PRIu64, + hashes->salts_buf[0].scrypt_N, + hashes->salts_buf[0].scrypt_r, + hashes->salts_buf[0].scrypt_p, + scrypt_tmto_final, + tmp_size / 16); + } + else + { + hc_asprintf (&jit_build_options, "-DSCRYPT_N=%u -DSCRYPT_R=%u -DSCRYPT_P=%u -DSCRYPT_TMTO=%" PRIu64 " -DSCRYPT_TMP_ELEM=%" PRIu64, + hashes->salts_buf[0].scrypt_N, + hashes->salts_buf[0].scrypt_r, + hashes->salts_buf[0].scrypt_p, + scrypt_tmto_final, + tmp_size / 16); + } + } + else + { + hc_asprintf (&jit_build_options, "-DSCRYPT_N=%u -DSCRYPT_R=%u -DSCRYPT_P=%u -DSCRYPT_TMTO=%" PRIu64 " -DSCRYPT_TMP_ELEM=%" PRIu64, + hashes->salts_buf[0].scrypt_N, + hashes->salts_buf[0].scrypt_r, + hashes->salts_buf[0].scrypt_p, + scrypt_tmto_final, + tmp_size / 16); + } return jit_build_options; } diff --git a/src/modules/module_18100.c b/src/modules/module_18100.c index fc656b87e..c8e822411 100644 --- a/src/modules/module_18100.c +++ b/src/modules/module_18100.c @@ -50,6 +50,21 @@ int module_build_plain_postprocess (MAYBE_UNUSED const hashconfig_t *hashconfig, return base32_encode (int_to_base32, (const u8 *) src_buf, src_len, (u8 *) dst_buf); } +char *module_jit_build_options (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra, MAYBE_UNUSED const hashes_t *hashes, MAYBE_UNUSED const hc_device_param_t *device_param) +{ + char *jit_build_options = NULL; + + if ((device_param->device_vendor_id == VENDOR_ID_AMD) && (device_param->has_vperm == false)) + { + if ((hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) == 0) + { + hc_asprintf (&jit_build_options, "-cl-opt-disable"); + } + } + + return jit_build_options; +} + int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) { u32 *digest = (u32 *) digest_buf; @@ -161,7 +176,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_hook23 = MODULE_DEFAULT; module_ctx->module_hook_salt_size = MODULE_DEFAULT; module_ctx->module_hook_size = MODULE_DEFAULT; - module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_jit_build_options = module_jit_build_options; module_ctx->module_jit_cache_disable = MODULE_DEFAULT; module_ctx->module_kernel_accel_max = MODULE_DEFAULT; module_ctx->module_kernel_accel_min = MODULE_DEFAULT; diff --git a/src/modules/module_18200.c b/src/modules/module_18200.c index 1d6a8718f..23082813d 100644 --- a/src/modules/module_18200.c +++ b/src/modules/module_18200.c @@ -75,6 +75,19 @@ u32 module_kernel_threads_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYB return kernel_threads_max; } +bool module_unstable_warning (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra, MAYBE_UNUSED const hc_device_param_t *hc_device_param) +{ + if ((hc_device_param->device_vendor_id == VENDOR_ID_AMD) && (hc_device_param->has_vperm == false)) + { + if ((hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) == 0) + { + return true; + } + } + + return false; +} + int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) { u32 *digest = (u32 *) digest_buf; @@ -261,6 +274,6 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_st_hash = module_st_hash; module_ctx->module_st_pass = module_st_pass; module_ctx->module_tmp_size = MODULE_DEFAULT; - module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_unstable_warning = module_unstable_warning; module_ctx->module_warmup_disable = MODULE_DEFAULT; } From 4cf1e75871c1d1c3e2d2b0f9a02ae1a2ca84e9f6 Mon Sep 17 00:00:00 2001 From: jsteube Date: Sat, 2 Mar 2019 16:31:56 +0100 Subject: [PATCH 2/2] Add some module specific warnings for ROCM driver in pure kernel mode --- src/modules/module_04800.c | 18 +++++++++++++++++- src/modules/module_08100.c | 2 +- src/modules/module_11600.c | 9 ++++++++- tools/test.pl | 2 +- tools/test.sh | 2 +- 5 files changed, 28 insertions(+), 5 deletions(-) diff --git a/src/modules/module_04800.c b/src/modules/module_04800.c index 4ec242265..304431cfa 100644 --- a/src/modules/module_04800.c +++ b/src/modules/module_04800.c @@ -47,6 +47,22 @@ u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } +char *module_jit_build_options (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra, MAYBE_UNUSED const hashes_t *hashes, MAYBE_UNUSED const hc_device_param_t *device_param) +{ + char *jit_build_options = NULL; + + if ((device_param->device_vendor_id == VENDOR_ID_AMD) && (device_param->has_vperm == true)) + { + if ((hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) == 0) + { +// hc_asprintf (&jit_build_options, "-cl-opt-disable"); + hc_asprintf (&jit_build_options, "-D MAYBE_VOLATILE=volatile"); + } + } + + return jit_build_options; +} + int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) { u32 *digest = (u32 *) digest_buf; @@ -179,7 +195,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_hook23 = MODULE_DEFAULT; module_ctx->module_hook_salt_size = MODULE_DEFAULT; module_ctx->module_hook_size = MODULE_DEFAULT; - module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_jit_build_options = module_jit_build_options; module_ctx->module_jit_cache_disable = MODULE_DEFAULT; module_ctx->module_kernel_accel_max = MODULE_DEFAULT; module_ctx->module_kernel_accel_min = MODULE_DEFAULT; diff --git a/src/modules/module_08100.c b/src/modules/module_08100.c index 2abfae4d2..8686638d4 100644 --- a/src/modules/module_08100.c +++ b/src/modules/module_08100.c @@ -191,7 +191,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_hook23 = MODULE_DEFAULT; module_ctx->module_hook_salt_size = MODULE_DEFAULT; module_ctx->module_hook_size = MODULE_DEFAULT; - module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_jit_build_options = module_jit_build_options; module_ctx->module_jit_cache_disable = MODULE_DEFAULT; module_ctx->module_kernel_accel_max = MODULE_DEFAULT; module_ctx->module_kernel_accel_min = MODULE_DEFAULT; diff --git a/src/modules/module_11600.c b/src/modules/module_11600.c index 2ace802d8..d613ed0af 100644 --- a/src/modules/module_11600.c +++ b/src/modules/module_11600.c @@ -290,7 +290,14 @@ char *module_jit_build_options (MAYBE_UNUSED const hashconfig_t *hashconfig, MAY if ((hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) == 0) { hc_asprintf (&jit_build_options, "-cl-opt-disable"); -// hc_asprintf (&jit_build_options, "-D MAYBE_VOLATILE=volatile"); + } + } + + if ((device_param->device_vendor_id == VENDOR_ID_AMD) && (device_param->has_vperm == true)) + { + if ((hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) == 0) + { + hc_asprintf (&jit_build_options, "-D MAYBE_VOLATILE=volatile"); } } diff --git a/tools/test.pl b/tools/test.pl index 353d584e3..ca9fa563d 100755 --- a/tools/test.pl +++ b/tools/test.pl @@ -16,7 +16,7 @@ use List::Util 'shuffle'; # allows require by filename use lib "$FindBin::Bin/test_modules"; -my $IS_OPTIMIZED = 1; +my $IS_OPTIMIZED = 0; my $TYPES = [ 'single', 'passthrough', 'verify' ]; diff --git a/tools/test.sh b/tools/test.sh index a7c1d143f..30da2adea 100755 --- a/tools/test.sh +++ b/tools/test.sh @@ -5,7 +5,7 @@ ## License.....: MIT ## -OPTS="--quiet --force --potfile-disable --runtime 400 --hwmon-disable -O" +OPTS="--quiet --force --potfile-disable --runtime 400 --hwmon-disable" TDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"