pull/2387/head
Jens Steube 4 years ago
commit 81cb508808

@ -116,7 +116,6 @@
- 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
- OpenCL Runtime: Not using amd_bytealign (amd_bitalign is fine) on AMDGPU driver drastically reduces JiT segfaults
- OpenCL Runtime: Reenabled support for Intel GPU OpenCL runtime (Beignet and NEO) because a workaround was found (force -cl-std=CL2.0)
- OpenCL Runtime: Unlocked maximum thread count for NVIDIA GPU
- OpenCL Runtime: Update unstable mode warnings for Apple and AMDGPU drivers
- OpenCL Runtime: Workaround JiT compiler error on AMDGPU driver compiling WPA-EAPOL-PBKDF2 OpenCL kernel

@ -37,8 +37,7 @@ _hashcat_backend_devices ()
# sanity check, all device ids must be numerical
if [ -n "${cur_selection}" ]; then
if echo "${cur_selection}" | sed 's/,/\n/g' | grep -q -v '^[0-9]\+$'
then
if echo "${cur_selection}" | sed 's/,/\n/g' | grep -q -v '^[0-9]\+$'; then
return
fi
fi
@ -155,6 +154,7 @@ _hashcat_backend_devices ()
_hashcat_cpu_devices ()
{
local cur_selection="${1}"
hashcat_device_list=""
if [ ! -f "/proc/cpuinfo" ]; then
@ -172,8 +172,7 @@ _hashcat_cpu_devices ()
# sanity check, all device ids must be numerical
if [ -n "${cur_selection}" ]; then
if echo "${cur_selection}" | sed 's/,/\n/g' | grep -q -v '^[0-9]\+$'
then
if echo "${cur_selection}" | sed 's/,/\n/g' | grep -q -v '^[0-9]\+$'; then
return
fi
fi
@ -220,7 +219,7 @@ _hashcat_cpu_devices ()
_hashcat_files_replace_home ()
{
local cur_select="${1}"
local cur_files="${2}"
local cur_files="${2}"
hashcat_select="${cur_select}"
hashcat_file_list="${cur_files}"
@ -235,43 +234,147 @@ _hashcat_files_replace_home ()
fi
}
_hashcat_files_include ()
_hashcat_recursive_file_search ()
{
local cur_select="${1}"
local cur_filter="${2}"
local allow_dir="${1}"
local is_include="${2}"
local file_list="${3}"
local cur_filter="${4}"
# allow starting/ending quotes (" and '):
local grep_flags="-Ei"
cur_select=$(echo -n "${cur_select}" | sed 's/^["'"'"']//' | sed 's/["'"'"']\$//')
if [ "${is_include}" -eq 0 ]; then
grep_flags="-Eiv"
fi
hashcat_file_list=""
local dir_loop=""
for dir_loop in "${file_list}"; do
if [ -d "${dir_loop}" ]; then
# check subdirs:
local subdir="${dir_loop}"
local loop_cnt=0
for loop_cnt in $(seq 1 35); do # maximum number of recursive (subdir) tests
local subdir_files=$(bash -c "ls -d ${subdir}/*" 2> /dev/null | grep ${grep_flags} '*\.('${cur_filter}')' 2> /dev/null)
if [ "${allow_dir}" -eq 1 ]; then
if [ -n "${hashcat_file_list}" ]; then
hashcat_file_list="${hashcat_file_list} "
fi
hashcat_file_list="${hashcat_file_list}${subdir}"
fi
if [ -z "${subdir_files}" ]; then
break
fi
hashcat_file_list=$(bash -c "ls -d ${cur_select}*" 2> /dev/null | grep -Ei "${cur_filter}" 2> /dev/null)
local subdir_file=""
for subdir_file in "${subdir_files}"; do
if [ "${allow_dir}" -eq 1 ]; then
if [ -n "${hashcat_file_list}" ]; then
hashcat_file_list="${hashcat_file_list} "
fi
hashcat_file_list="${hashcat_file_list}${subdir_file}"
else
if [ ! -d "${subdir_file}" ]; then
if [ -n "${hashcat_file_list}" ]; then
hashcat_file_list="${hashcat_file_list} "
fi
# special case: add all folders/directories (ending with "/")
hashcat_file_list="${hashcat_file_list}${subdir_file}"
fi
fi
done
local amount=$(echo "${subdir_files}" | wc -l)
if [ "${amount}" -gt 1 ]; then
break
fi
local all_dirs=$(bash -c "ls -d ${cur_select}*/" 2> /dev/null)
subdir="${subdir_files}"
done
else
if [ -n "${hashcat_file_list}" ]; then
hashcat_file_list="${hashcat_file_list} "
fi
hashcat_file_list="${hashcat_file_list} ${all_dirs}"
hashcat_file_list="${hashcat_file_list}${dir_loop}"
fi
done
}
_hashcat_include ()
{
local allow_dir="${1}"
local cur_select="${2}"
local cur_filter="${3}"
# special case: $HOME directory (~/)
# allow starting/ending quotes (" and '):
cur_select=$(echo -n "${cur_select}" | sed 's/^["'"'"']//' | sed 's/["'"'"']\$//')
local file_list=$(bash -c "ls -d ${cur_select}*" 2> /dev/null | grep -Ei "${cur_filter}" 2> /dev/null)
_hashcat_recursive_file_search "${allow_dir}" 1 "${file_list}" "${cur_filter}"
if [ "${allow_dir}" -eq 1 ]; then
if [ -d "${cur_select}" ]; then
if [ -n "${hashcat_file_list}" ]; then
hashcat_file_list="${hashcat_file_list} "
fi
hashcat_file_list="${hashcat_file_list}${cur_select}"
fi
fi
# handle special case for $HOME directory (~/)
_hashcat_files_replace_home "${cur_select}" "${hashcat_file_list}"
# (hashcat_select and hashcat_file_list are modified and "returned")
}
_hashcat_files_exclude ()
_hashcat_files_include ()
{
local cur_select="${1}"
local cur_filter="${2}"
_hashcat_include 0 "${1}" "${2}"
}
_hashcat_files_folders_include ()
{
_hashcat_include 1 "${1}" "${2}"
}
_hashcat_exclude ()
{
local allow_dir="${1}"
local cur_select="${2}"
local cur_filter="${3}"
# allow starting/ending quotes (" and '):
cur_select=$(echo -n "${cur_select}" | sed 's/^["'"'"']//' | sed 's/["'"'"']\$//')
hashcat_file_list=$(bash -c "ls -d ${cur_select}*" 2> /dev/null | grep -Eiv '*\.('${cur_filter}')' 2> /dev/null)
local file_list=$(bash -c "ls -d ${cur_select}*" 2> /dev/null | grep -Eiv '*\.('${cur_filter}')' 2> /dev/null)
_hashcat_recursive_file_search "${allow_dir}" 0 "${file_list}" "${cur_filter}"
if [ "${allow_dir}" -eq 1 ]; then
if [ -d "${cur_select}" ]; then
if [ -n "${hashcat_file_list}" ]; then
hashcat_file_list="${hashcat_file_list} "
fi
hashcat_file_list="${hashcat_file_list}${cur_select}"
fi
fi
# handle special case for $HOME directory (~/)
@ -280,14 +383,24 @@ _hashcat_files_exclude ()
# (hashcat_select and hashcat_file_list are modified and "returned")
}
_hashcat_files_exclude ()
{
_hashcat_exclude 0 "${1}" "${2}"
}
_hashcat_files_folders_exclude ()
{
_hashcat_exclude 1 "${1}" "${2}"
}
_hashcat_contains ()
{
local haystack=${1}
local needle="${2}"
if echo "${haystack}" | grep -q " ${needle} " 2> /dev/null; then
if echo "${haystack}" | grep -q " ${needle} " 2> /dev/null; then
return 0
elif echo "${haystack}" | grep -q "^${needle} " 2> /dev/null; then
elif echo "${haystack}" | grep -q "^${needle} " 2> /dev/null; then
return 0
elif echo "${haystack}" | grep -q " ${needle}\$" 2> /dev/null; then
return 0
@ -430,10 +543,8 @@ _hashcat ()
local mask=${BUILD_IN_CHARSETS}
if [ -e "${cur}" ]; then # should be hcchr file (but not enforced)
COMPREPLY=($(compgen -W "${cur}" -- ${cur}))
return 0
fi
if [ -n "${cur}" ]; then
@ -712,7 +823,7 @@ _hashcat ()
0)
# dict/directory are files here
_hashcat_files_exclude "${cur}" "${HIDDEN_FILES_AGGRESSIVE}"
_hashcat_files_folders_exclude "${cur}" "${HIDDEN_FILES_AGGRESSIVE}"
COMPREPLY=($(compgen -W "${hashcat_file_list}" -- ${hashcat_select}))
return 0
;;
@ -722,7 +833,7 @@ _hashcat ()
return 0
fi
_hashcat_files_exclude "${cur}" "${HIDDEN_FILES_AGGRESSIVE}"
_hashcat_files_folders_exclude "${cur}" "${HIDDEN_FILES_AGGRESSIVE}"
COMPREPLY=($(compgen -W "${hashcat_file_list}" -- ${hashcat_select}))
return 0
;;
@ -779,7 +890,7 @@ _hashcat ()
6)
if [ "${no_opts}" -eq 2 ]; then
_hashcat_files_exclude "${cur}" "${HIDDEN_FILES_AGGRESSIVE}"
_hashcat_files_folders_exclude "${cur}" "${HIDDEN_FILES_AGGRESSIVE}"
COMPREPLY=($(compgen -W "${hashcat_file_list}" -- ${hashcat_select}))
elif [ "${no_opts}" -eq 3 ]; then
@ -820,7 +931,7 @@ _hashcat ()
mask="${mask} ${cur_var}"
fi
_hashcat_files_exclude "${cur}" "${HIDDEN_FILES}"
_hashcat_files_folders_exclude "${cur}" "${HIDDEN_FILES}"
mask="${mask} ${hashcat_file_list}"
@ -869,7 +980,7 @@ _hashcat ()
mask="${mask} ${cur_var}"
fi
_hashcat_files_exclude "${cur}" "${HIDDEN_FILES}"
_hashcat_files_folders_exclude "${cur}" "${HIDDEN_FILES}"
mask="${mask} ${hashcat_file_list}"
@ -878,7 +989,7 @@ _hashcat ()
elif [ "${no_opts}" -eq 3 ]; then
_hashcat_files_exclude "${cur}" "${HIDDEN_FILES_AGGRESSIVE}"
_hashcat_files_folders_exclude "${cur}" "${HIDDEN_FILES_AGGRESSIVE}"
COMPREPLY=($(compgen -W "${hashcat_file_list}" -- ${hashcat_select}))
return 0

@ -1280,6 +1280,7 @@ typedef struct hc_device_param
bool use_opencl12;
bool use_opencl20;
bool use_opencl21;
// AMD
bool has_vadd;

@ -43,6 +43,10 @@ static bool is_same_device (const hc_device_param_t *src, const hc_device_param_
if (src->pcie_device != dst->pcie_device) return false;
if (src->pcie_function != dst->pcie_function) return false;
// Intel CPU and embedded GPU would survive up to here!
if (src->opencl_device_type != dst->opencl_device_type) return false;
return true;
}
@ -5364,6 +5368,7 @@ int backend_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime)
device_param->use_opencl12 = false;
device_param->use_opencl20 = false;
device_param->use_opencl21 = false;
// device_name
@ -5648,12 +5653,14 @@ int backend_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime)
cl_device_id **opencl_platforms_devices = backend_ctx->opencl_platforms_devices;
cl_uint *opencl_platforms_devices_cnt = backend_ctx->opencl_platforms_devices_cnt;
cl_uint *opencl_platforms_vendor_id = backend_ctx->opencl_platforms_vendor_id;
char **opencl_platforms_version = backend_ctx->opencl_platforms_version;
for (u32 opencl_platforms_idx = 0; opencl_platforms_idx < opencl_platforms_cnt; opencl_platforms_idx++)
{
cl_device_id *opencl_platform_devices = opencl_platforms_devices[opencl_platforms_idx];
cl_uint opencl_platform_devices_cnt = opencl_platforms_devices_cnt[opencl_platforms_idx];
cl_uint opencl_platform_vendor_id = opencl_platforms_vendor_id[opencl_platforms_idx];
char *opencl_platform_version = opencl_platforms_version[opencl_platforms_idx];
for (u32 opencl_platform_devices_idx = 0; opencl_platform_devices_idx < opencl_platform_devices_cnt; opencl_platform_devices_idx++, backend_devices_idx++, opencl_devices_cnt++)
{
@ -5677,8 +5684,30 @@ int backend_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime)
device_param->is_opencl = true;
// check OpenCL version
device_param->use_opencl12 = false;
device_param->use_opencl20 = false;
device_param->use_opencl21 = false;
int opencl_version_min = 0;
int opencl_version_maj = 0;
if (sscanf (opencl_platform_version, "OpenCL %d.%d", &opencl_version_min, &opencl_version_maj) == 2)
{
if ((opencl_version_min == 1) && (opencl_version_maj == 2))
{
device_param->use_opencl12 = true;
}
else if ((opencl_version_min == 2) && (opencl_version_maj == 0))
{
device_param->use_opencl20 = true;
}
else if ((opencl_version_min == 2) && (opencl_version_maj == 1))
{
device_param->use_opencl21 = true;
}
}
size_t param_value_size = 0;
@ -5793,23 +5822,6 @@ int backend_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime)
device_param->opencl_device_c_version = opencl_device_c_version;
// check OpenCL version
int opencl_version_min = 0;
int opencl_version_maj = 0;
if (sscanf (opencl_device_c_version, "OpenCL C %d.%d", &opencl_version_min, &opencl_version_maj) == 2)
{
if ((opencl_version_min == 1) && (opencl_version_maj == 2))
{
device_param->use_opencl12 = true;
}
else if ((opencl_version_min == 2) && (opencl_version_maj == 0))
{
device_param->use_opencl20 = true;
}
}
// max_compute_units
cl_uint device_processors = 0;
@ -7740,8 +7752,9 @@ int backend_session_begin (hashcat_ctx_t *hashcat_ctx)
build_options_len += snprintf (build_options_buf + build_options_len, build_options_sz - build_options_len, "-D KERNEL_STATIC -I OpenCL -I %s ", folder_config->cpath_real);
#endif
// workarounds reproduceable bugs on some OpenCL runtimes (Beignet and NEO)
// ex: remove empty code in m04, m08 and m16 in OpenCL/m05600_a3-optimized.cl will break s04 kernel (not cracking anymore)
/* currently disabled, hangs NEO drivers since 20.09.
was required for NEO driver 20.08 to workaround the same issue!
we go with the latest version
if (device_param->is_opencl == true)
{
@ -7753,7 +7766,12 @@ int backend_session_begin (hashcat_ctx_t *hashcat_ctx)
{
build_options_len += snprintf (build_options_buf + build_options_len, build_options_sz - build_options_len, "-cl-std=CL2.0 ");
}
else if (device_param->use_opencl21 == true)
{
build_options_len += snprintf (build_options_buf + build_options_len, build_options_sz - build_options_len, "-cl-std=CL2.1 ");
}
}
*/
// we don't have sm_* on vendors not NV but it doesn't matter

@ -75,6 +75,15 @@ u32 module_kernel_threads_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYB
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 *device_param)
{
if (device_param->opencl_platform_vendor_id == VENDOR_ID_APPLE)
{
// self-test failed
if ((device_param->opencl_device_vendor_id == VENDOR_ID_INTEL_SDK) && (device_param->opencl_device_type & CL_DEVICE_TYPE_GPU))
{
return true;
}
}
// amdgpu-pro-19.30-934563-ubuntu-18.04: CL_OUT_OF_RESOURCES
if ((device_param->opencl_device_vendor_id == VENDOR_ID_AMD) && (device_param->has_vperm == false))
{

Loading…
Cancel
Save