From 62d5d2dfbba23a33bfde9bb82fed51baa1505f45 Mon Sep 17 00:00:00 2001 From: Jens Steube Date: Mon, 17 Jun 2019 17:35:23 +0200 Subject: [PATCH] OpenCL Runtime: Workaround ROCm OpenCL driver problem trying to write temporary file into readonly folder by setting TMPDIR environment variable --- docs/changes.txt | 1 + include/shared.h | 2 +- src/hashcat.c | 2 +- src/shared.c | 14 +++++++++++++- 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/docs/changes.txt b/docs/changes.txt index d28b45430..53a5232b2 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -69,6 +69,7 @@ - OpenCL Runtime: Workaround JiT compiler error on AMDGPU driver compiling WPA-EAPOL-PBKDF2 OpenCL kernel - OpenCL Runtime: Workaround JiT compiler error on ROCM 2.3 driver if the 'inline' keyword is used in function declaration - OpenCL Runtime: Workaround memory allocation error on AMD driver on Windows leading to CL_MEM_OBJECT_ALLOCATION_FAILURE +- OpenCL Runtime: Workaround ROCm OpenCL driver problem trying to write temporary file into readonly folder by setting TMPDIR - Startup Screen: Provide an estimate of host memory requirements for the requested attack - Tuning Database: Updated hashcat.hctune with new models and refreshed vector width values - WPA/WPA2 cracking: In the potfile, replace password with PMK in order to detect already cracked networks across all WPA modes diff --git a/include/shared.h b/include/shared.h index 346aac75b..a85f19490 100644 --- a/include/shared.h +++ b/include/shared.h @@ -40,7 +40,7 @@ void naive_escape (char *s, size_t s_max, const char key_char, const char escape __attribute__ ((format (printf, 2, 3))) int hc_asprintf (char **strp, const char *fmt, ...); -void setup_environment_variables (void); +void setup_environment_variables (const folder_config_t *folder_config); void setup_umask (void); void setup_seeding (const bool rp_gen_seed_chgd, const u32 rp_gen_seed); diff --git a/src/hashcat.c b/src/hashcat.c index 7a3838c43..a04dafc50 100644 --- a/src/hashcat.c +++ b/src/hashcat.c @@ -1108,7 +1108,7 @@ int hashcat_session_init (hashcat_ctx_t *hashcat_ctx, const char *install_folder * To help users a bit */ - setup_environment_variables (); + setup_environment_variables (hashcat_ctx->folder_config); setup_umask (); diff --git a/src/shared.c b/src/shared.c index e9b06822d..9d26f1d46 100644 --- a/src/shared.c +++ b/src/shared.c @@ -7,6 +7,7 @@ #include "types.h" #include "convert.h" #include "shared.h" +#include "memory.h" #if defined (__CYGWIN__) #include @@ -467,7 +468,7 @@ bool hc_string_is_digit (const char *s) return true; } -void setup_environment_variables () +void setup_environment_variables (const folder_config_t *folder_config) { char *compute = getenv ("COMPUTE"); @@ -498,6 +499,17 @@ void setup_environment_variables () putenv ((char *) "POCL_KERNEL_CACHE=0"); */ + if (getenv ("TMPDIR") == NULL) + { + char *tmpdir = NULL; + + hc_asprintf (&tmpdir, "TMPDIR=%s", folder_config->profile_dir); + + putenv (tmpdir); + + // we can't free tmpdir at this point! + } + if (getenv ("CL_CONFIG_USE_VECTORIZER") == NULL) putenv ((char *) "CL_CONFIG_USE_VECTORIZER=False");