From 008072eb65cb104cfa0fe30f7e80798eca23987f Mon Sep 17 00:00:00 2001 From: Jens Steube Date: Wed, 1 Apr 2020 10:16:49 +0200 Subject: [PATCH] OpenCL Runtime: Added a warning if OpenCL runtime NEO, Beignet, POCL or MESA is detected and skip associated devices (override with --force) --- docs/changes.txt | 3 +- docs/readme.txt | 13 ++------ src/backend.c | 82 +++++++++++++++++++++++++++--------------------- 3 files changed, 52 insertions(+), 46 deletions(-) diff --git a/docs/changes.txt b/docs/changes.txt index 5c002432b..74457c42f 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -113,6 +113,7 @@ - File handling: Print a truncation warning when an oversized line is detected - My Wallet: Added additional plaintext pattern used in newer versions - Office cracking: Support hash format with second block data for 40-bit oldoffice files (eliminates false positives) +- OpenCL Runtime: Added a warning if OpenCL runtime NEO, Beignet, POCL or MESA is detected and skip associated devices (override with --force) - OpenCL Runtime: Disable OpenCL kernel cache on Apple for Intel CPU (throws CL_BUILD_PROGRAM_FAILURE for no reason) - OpenCL Runtime: Do not run shared- and constant-memory size checks if their memory type is of type global memory (typically CPU) - OpenCL Runtime: Improve ROCm detection and make sure to not confuse with recent AMDGPU drivers @@ -166,7 +167,7 @@ - OpenCL Options: Removed --opencl-platforms filter in order to force backend device numbers to stay constant - Parsers: switched from strtok() to strtok_r() for thread safety - Requirements: Add new requirement for NVIDIA GPU: CUDA Toolkit (9.0 or later) -- Requirements: Update runtime check for minimum NVIDIA driver version from 367.x to 418.56 or later +- Requirements: Update runtime check for minimum NVIDIA driver version from 367.x to 440.64 or later - Test Script: Switched from /bin/bash to generic /bin/sh and updated code accordingly * changes v5.0.0 -> v5.1.0 diff --git a/docs/readme.txt b/docs/readme.txt index 372197e3d..e550b3c81 100644 --- a/docs/readme.txt +++ b/docs/readme.txt @@ -10,12 +10,10 @@ hashcat v5.1.0 ============== -AMD GPUs on Linux require "RadeonOpenCompute (ROCm)" Software Platform (1.6.180 or later) -AMD GPUs on Windows require "AMD Radeon Software Crimson Edition" (15.12 or later) +AMD GPUs on Linux require "RadeonOpenCompute (ROCm)" Software Platform (3.1 or later) +AMD GPUs on Windows require "AMD Radeon Adrenalin 2020 Edition" (20.2.2 or later) Intel CPUs require "OpenCL Runtime for Intel Core and Intel Xeon Processors" (16.1.1 or later) -Intel GPUs on Linux require "OpenCL 2.0 GPU Driver Package for Linux" (2.0 or later) -Intel GPUs on Windows require "OpenCL Driver for Intel Iris and Intel HD Graphics" -NVIDIA GPUs require "NVIDIA Driver" (418.56 or later) and "CUDA Toolkit" (9.0 or later) +NVIDIA GPUs require "NVIDIA Driver" (440.64 or later) and "CUDA Toolkit" (9.0 or later) ## ## Features @@ -342,9 +340,7 @@ NVIDIA GPUs require "NVIDIA Driver" (418.56 or later) and "CUDA Toolkit" (9.0 or - AMD - Apple - Intel -- Mesa (Gallium) - NVidia -- pocl ## ## Supported OpenCL device types @@ -353,6 +349,3 @@ NVIDIA GPUs require "NVIDIA Driver" (418.56 or later) and "CUDA Toolkit" (9.0 or - GPU - CPU - APU -- DSP -- FPGA -- Coprocessor diff --git a/src/backend.c b/src/backend.c index fdc8dba83..2843d6f71 100644 --- a/src/backend.c +++ b/src/backend.c @@ -4976,25 +4976,17 @@ int backend_ctx_init (hashcat_ctx_t *hashcat_ctx) #if defined (__linux__) event_log_warning (hashcat_ctx, "* AMD GPUs on Linux require this driver:"); - event_log_warning (hashcat_ctx, " \"RadeonOpenCompute (ROCm)\" Software Platform (1.6.180 or later)"); + event_log_warning (hashcat_ctx, " \"RadeonOpenCompute (ROCm)\" Software Platform (3.1 or later)"); #elif defined (_WIN) event_log_warning (hashcat_ctx, "* AMD GPUs on Windows require this driver:"); - event_log_warning (hashcat_ctx, " \"AMD Radeon Software Crimson Edition\" (15.12 or later)"); + event_log_warning (hashcat_ctx, " \"AMD Radeon Adrenalin 2020 Edition\" (20.2.2 or later)"); #endif event_log_warning (hashcat_ctx, "* Intel CPUs require this runtime:"); event_log_warning (hashcat_ctx, " \"OpenCL Runtime for Intel Core and Intel Xeon Processors\" (16.1.1 or later)"); - #if defined (__linux__) - event_log_warning (hashcat_ctx, "* Intel GPUs on Linux require this driver:"); - event_log_warning (hashcat_ctx, " \"OpenCL 2.0 GPU Driver Package for Linux\" (2.0 or later)"); - #elif defined (_WIN) - event_log_warning (hashcat_ctx, "* Intel GPUs on Windows require this driver:"); - event_log_warning (hashcat_ctx, " \"OpenCL Driver for Intel Iris and Intel HD Graphics\""); - #endif - event_log_warning (hashcat_ctx, "* NVIDIA GPUs require this runtime and/or driver (both):"); - event_log_warning (hashcat_ctx, " \"NVIDIA Driver\" (418.56 or later)"); + event_log_warning (hashcat_ctx, " \"NVIDIA Driver\" (440.64 or later)"); event_log_warning (hashcat_ctx, " \"CUDA Toolkit\" (9.0 or later)"); event_log_warning (hashcat_ctx, NULL); @@ -5258,25 +5250,17 @@ int backend_ctx_init (hashcat_ctx_t *hashcat_ctx) #if defined (__linux__) event_log_warning (hashcat_ctx, "* AMD GPUs on Linux require this driver:"); - event_log_warning (hashcat_ctx, " \"RadeonOpenCompute (ROCm)\" Software Platform (1.6.180 or later)"); + event_log_warning (hashcat_ctx, " \"RadeonOpenCompute (ROCm)\" Software Platform (3.1 or later)"); #elif defined (_WIN) event_log_warning (hashcat_ctx, "* AMD GPUs on Windows require this driver:"); - event_log_warning (hashcat_ctx, " \"AMD Radeon Software Crimson Edition\" (15.12 or later)"); + event_log_warning (hashcat_ctx, " \"AMD Radeon Adrenalin 2020 Edition\" (20.2.2 or later)"); #endif event_log_warning (hashcat_ctx, "* Intel CPUs require this runtime:"); event_log_warning (hashcat_ctx, " \"OpenCL Runtime for Intel Core and Intel Xeon Processors\" (16.1.1 or later)"); - #if defined (__linux__) - event_log_warning (hashcat_ctx, "* Intel GPUs on Linux require this driver:"); - event_log_warning (hashcat_ctx, " \"OpenCL 2.0 GPU Driver Package for Linux\" (2.0 or later)"); - #elif defined (_WIN) - event_log_warning (hashcat_ctx, "* Intel GPUs on Windows require this driver:"); - event_log_warning (hashcat_ctx, " \"OpenCL Driver for Intel Iris and Intel HD Graphics\""); - #endif - event_log_warning (hashcat_ctx, "* NVIDIA GPUs require this runtime and/or driver (both):"); - event_log_warning (hashcat_ctx, " \"NVIDIA Driver\" (418.56 or later)"); + event_log_warning (hashcat_ctx, " \"NVIDIA Driver\" (440.64 or later)"); event_log_warning (hashcat_ctx, " \"CUDA Toolkit\" (9.0 or later)"); event_log_warning (hashcat_ctx, NULL); @@ -6002,12 +5986,45 @@ int backend_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime) { if (user_options->quiet == false) event_log_warning (hashcat_ctx, "* Device #%u: Not a native Intel OpenCL runtime. Expect massive speed loss.", device_id + 1); if (user_options->quiet == false) event_log_warning (hashcat_ctx, " You can use --force to override, but do not report related errors."); + if (user_options->quiet == false) event_log_warning (hashcat_ctx, NULL); device_param->skipped = true; } } } + char *opencl_device_version_lower = hcstrdup (opencl_device_version); + + lowercase ((u8 *) opencl_device_version_lower, strlen (opencl_device_version_lower)); + + if ((strstr (opencl_device_version_lower, "neo ")) + || (strstr (opencl_device_version_lower, " neo")) + || (strstr (opencl_device_version_lower, "beignet ")) + || (strstr (opencl_device_version_lower, " beignet")) + || (strstr (opencl_device_version_lower, "pocl ")) + || (strstr (opencl_device_version_lower, " pocl")) + || (strstr (opencl_device_version_lower, "mesa ")) + || (strstr (opencl_device_version_lower, " mesa"))) + { + // NEO: https://github.com/hashcat/hashcat/issues/2342 + // BEIGNET: https://github.com/hashcat/hashcat/issues/2243 + // POCL: https://github.com/hashcat/hashcat/issues/2344 + // MESA: https://github.com/hashcat/hashcat/issues/2269 + + if (user_options->force == false) + { + event_log_error (hashcat_ctx, "* Device #%u: Unstable OpenCL driver detected!", device_id + 1); + + if (user_options->quiet == false) event_log_warning (hashcat_ctx, "This OpenCL driver has been marked as likely to fail kernel compilation or to produce false negatives."); + if (user_options->quiet == false) event_log_warning (hashcat_ctx, "You can use --force to override this, but do not report related errors."); + if (user_options->quiet == false) event_log_warning (hashcat_ctx, NULL); + + device_param->skipped = true; + } + } + + hcfree (opencl_device_version_lower); + // Since some times we get reports from users about not working hashcat, dropping error messages like: // CL_INVALID_COMMAND_QUEUE and CL_OUT_OF_RESOURCES // Turns out that this is caused by Intel OpenCL runtime handling their GPU devices @@ -6245,24 +6262,19 @@ int backend_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime) if (r == 2) { - if (version_maj >= 367) + if (version_maj >= 440) { - if (version_maj == 418) - { - // older 418.x versions are known to be broken. - // for instance, NVIDIA-Linux-x86_64-418.43.run - // run ./hashcat -b -m 2501 results in self-test fail - - if (version_min >= 56) - { - nv_warn = false; - } - } - else + if (version_min >= 64) { nv_warn = false; } } + else + { + // unknown version scheme, probably new driver version + + nv_warn = false; + } } else {