[GH-ISSUE #1952] segfault in hmac-sha256 self test (clang, 64bit Linux avx) #1301

Closed
opened 2026-10-14 03:43:22 +07:00 by bsakaguchi · 14 comments
Owner

Originally created by @frank-dittrich on GitHub (Dec 11, 2015).
Original GitHub issue: https://github.com/openwall/john/issues/1952

Originally assigned to: @frank-dittrich on GitHub.

(bleeding-jumbo)run $ ./john --test=0 --format=hmac-sha256 
Testing: HMAC-SHA256 [password is key, SHA256 128/128 AVX 4x]... Loaded 5 hashes with 5 different salts to test db from test vectors
Segmentation fault (core dumped)
(bleeding-jumbo)run $ ./john --list=build-info 
Version: 1.8.0.6-jumbo-1-1763-g7775e14
Build: linux-gnu 64-bit AVX-ac
SIMD: AVX, interleaving: MD4:4 MD5:5 SHA1:2 SHA256:1 SHA512:1
$JOHN is ./
Format interface version: 13
Max. number of reported tunable costs: 3
Rec file version: REC4
Charset file version: CHR3
CHARSET_MIN: 1 (0x01)
CHARSET_MAX: 255 (0xff)
CHARSET_LENGTH: 24
SALT_HASH_SIZE: 1048576
Max. Markov mode level: 400
Max. Markov mode password length: 30
clang version: 3.5.0 (tags/RELEASE_350/final) (gcc 4.3.0 compatibility)
GNU libc version: 2.21 (loaded: 2.21)
Crypto library: OpenSSL
OpenSSL library version: 0100010bf
OpenSSL 1.0.1k-fips 8 Jan 2015
GMP library version: 6.0.0
File locking: fcntl()
fseek(): fseek
ftell(): ftell
fopen(): fopen
memmem(): System's
(gdb) run --test=0 --format=hmac-sha256
Starting program: /home/fd/git/JtR/run/john --test=0 --format=hmac-sha256
Missing separate debuginfos, use: dnf debuginfo-install glibc-2.21-8.fc22.x86_64
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Testing: HMAC-SHA256 [password is key, SHA256 128/128 AVX 4x]... Loaded 5 hashes with 5 different salts to test db from test vectors

Program received signal SIGSEGV, Segmentation fault.
SIMDSHA256body (data=0xf87021, out=0xf869d0, reload_state=0xf86d00, SSEi_flags=40) at simd-intrinsics.c:1826
1826            memcpy(_w, data, 16*sizeof(vtype)*SIMD_PARA_SHA256);
Missing separate debuginfos, use: dnf debuginfo-install gmp-6.0.0-9.fc22.x86_64 keyutils-libs-1.5.9-4.fc22.x86_64 krb5-libs-1.13.2-10.fc22.x86_64 libcom_err-1.42.12-4.fc22.x86_64 libselinux-2.3-10.fc22.x86_64 nss-softokn-freebl-3.21.0-1.1.fc22.x86_64 openssl-libs-1.0.1k-12.fc22.x86_64 pcre-8.37-5.fc22.x86_64 zlib-1.2.8-7.fc22.x86_64
(gdb) bt
#0  SIMDSHA256body (data=0xf87021, out=0xf869d0, reload_state=0xf86d00, SSEi_flags=40) at simd-intrinsics.c:1826
#1  0x0000000000521f04 in crypt_all (pcount=<optimized out>, salt=0xf869d0) at hmacSHA256_fmt_plug.c:406
#2  0x000000000059ee60 in is_key_right (format=0x98d340 <fmt_hmacSHA256>, index=0, binary=0xf868f4, 
    ciphertext=0xab0290 <split.out> "The quick brown fox jumps over the lazy dog#f7bc83f430538424b13298e6aa6fb143ef4d59a14946175997479dbc2d1a3cd8", plaintext=0x6fb241 "key", 
    is_test_fmt_case=0, dbsalt=0xf869d0) at formats.c:209
#3  0x000000000059e4ac in fmt_self_test_body (format=<optimized out>, db=<optimized out>, full_lvl=<optimized out>, binary_copy=<optimized out>, salt_copy=<optimized out>)
    at formats.c:836
#4  fmt_self_test (format=0x98d340 <fmt_hmacSHA256>, db=0xf86940) at formats.c:1593
#5  0x00000000005919e2 in benchmark_format (format=0x98d340 <fmt_hmacSHA256>, salts=256, results=0x7fffffffde08, test_db=0xf869d0) at bench.c:255
#6  0x000000000059259f in benchmark_all () at bench.c:687
#7  0x00000000005a2c0e in john_run () at john.c:1585
#8  0x00000000005a2405 in main (argc=3, argv=0x7fffffffe098) at john.c:1970
Originally created by @frank-dittrich on GitHub (Dec 11, 2015). Original GitHub issue: https://github.com/openwall/john/issues/1952 Originally assigned to: @frank-dittrich on GitHub. ``` (bleeding-jumbo)run $ ./john --test=0 --format=hmac-sha256 Testing: HMAC-SHA256 [password is key, SHA256 128/128 AVX 4x]... Loaded 5 hashes with 5 different salts to test db from test vectors Segmentation fault (core dumped) ``` ``` (bleeding-jumbo)run $ ./john --list=build-info Version: 1.8.0.6-jumbo-1-1763-g7775e14 Build: linux-gnu 64-bit AVX-ac SIMD: AVX, interleaving: MD4:4 MD5:5 SHA1:2 SHA256:1 SHA512:1 $JOHN is ./ Format interface version: 13 Max. number of reported tunable costs: 3 Rec file version: REC4 Charset file version: CHR3 CHARSET_MIN: 1 (0x01) CHARSET_MAX: 255 (0xff) CHARSET_LENGTH: 24 SALT_HASH_SIZE: 1048576 Max. Markov mode level: 400 Max. Markov mode password length: 30 clang version: 3.5.0 (tags/RELEASE_350/final) (gcc 4.3.0 compatibility) GNU libc version: 2.21 (loaded: 2.21) Crypto library: OpenSSL OpenSSL library version: 0100010bf OpenSSL 1.0.1k-fips 8 Jan 2015 GMP library version: 6.0.0 File locking: fcntl() fseek(): fseek ftell(): ftell fopen(): fopen memmem(): System's ``` ``` (gdb) run --test=0 --format=hmac-sha256 Starting program: /home/fd/git/JtR/run/john --test=0 --format=hmac-sha256 Missing separate debuginfos, use: dnf debuginfo-install glibc-2.21-8.fc22.x86_64 [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib64/libthread_db.so.1". Testing: HMAC-SHA256 [password is key, SHA256 128/128 AVX 4x]... Loaded 5 hashes with 5 different salts to test db from test vectors Program received signal SIGSEGV, Segmentation fault. SIMDSHA256body (data=0xf87021, out=0xf869d0, reload_state=0xf86d00, SSEi_flags=40) at simd-intrinsics.c:1826 1826 memcpy(_w, data, 16*sizeof(vtype)*SIMD_PARA_SHA256); Missing separate debuginfos, use: dnf debuginfo-install gmp-6.0.0-9.fc22.x86_64 keyutils-libs-1.5.9-4.fc22.x86_64 krb5-libs-1.13.2-10.fc22.x86_64 libcom_err-1.42.12-4.fc22.x86_64 libselinux-2.3-10.fc22.x86_64 nss-softokn-freebl-3.21.0-1.1.fc22.x86_64 openssl-libs-1.0.1k-12.fc22.x86_64 pcre-8.37-5.fc22.x86_64 zlib-1.2.8-7.fc22.x86_64 (gdb) bt #0 SIMDSHA256body (data=0xf87021, out=0xf869d0, reload_state=0xf86d00, SSEi_flags=40) at simd-intrinsics.c:1826 #1 0x0000000000521f04 in crypt_all (pcount=<optimized out>, salt=0xf869d0) at hmacSHA256_fmt_plug.c:406 #2 0x000000000059ee60 in is_key_right (format=0x98d340 <fmt_hmacSHA256>, index=0, binary=0xf868f4, ciphertext=0xab0290 <split.out> "The quick brown fox jumps over the lazy dog#f7bc83f430538424b13298e6aa6fb143ef4d59a14946175997479dbc2d1a3cd8", plaintext=0x6fb241 "key", is_test_fmt_case=0, dbsalt=0xf869d0) at formats.c:209 #3 0x000000000059e4ac in fmt_self_test_body (format=<optimized out>, db=<optimized out>, full_lvl=<optimized out>, binary_copy=<optimized out>, salt_copy=<optimized out>) at formats.c:836 #4 fmt_self_test (format=0x98d340 <fmt_hmacSHA256>, db=0xf86940) at formats.c:1593 #5 0x00000000005919e2 in benchmark_format (format=0x98d340 <fmt_hmacSHA256>, salts=256, results=0x7fffffffde08, test_db=0xf869d0) at bench.c:255 #6 0x000000000059259f in benchmark_all () at bench.c:687 #7 0x00000000005a2c0e in john_run () at john.c:1585 #8 0x00000000005a2405 in main (argc=3, argv=0x7fffffffe098) at john.c:1970 ```
bsakaguchi 2026-10-14 03:43:22 +07:00
Author
Owner

@magnumripper commented on GitHub (Dec 13, 2015):

I too got this. I saw another problem: The valid function is too promiscuos and the strcpy in split() may end up boffing. Several possble fixes but we shoud probably do it in valid().

My problems are possibly fixed by 8ab71ca1 and/or 97eee58

<!-- gh-comment-id:164212160 --> @magnumripper commented on GitHub (Dec 13, 2015): ~~I too got this~~. I saw another problem: The valid function is too promiscuos and the strcpy in split() may end up boffing. Several possble fixes but we shoud probably do it in valid(). My problems are possibly fixed by 8ab71ca1 and/or 97eee58
Author
Owner

@magnumripper commented on GitHub (Dec 16, 2015):

@frank-dittrich you should run this with ASan and see what is says. I can't reproduce.

<!-- gh-comment-id:165231308 --> @magnumripper commented on GitHub (Dec 16, 2015): @frank-dittrich you should run this with ASan and see what is says. I can't reproduce.
Author
Owner

@frank-dittrich commented on GitHub (Dec 16, 2015):

With ASan enabled, I can't reproduce.
Will try with --enable-ubsan next.

But with --test=0 for all formats, I get an ASan error for vdi:
https://github.com/magnumripper/JohnTheRipper/issues/1956

<!-- gh-comment-id:165272807 --> @frank-dittrich commented on GitHub (Dec 16, 2015): With ASan enabled, I can't reproduce. Will try with --enable-ubsan next. But with --test=0 for all formats, I get an ASan error for vdi: https://github.com/magnumripper/JohnTheRipper/issues/1956
Author
Owner

@frank-dittrich commented on GitHub (Dec 17, 2015):

Without ASan, but with UbSan, I get the segfault.

$ gdb ./john
GNU gdb (GDB) Fedora 7.9.1-20.fc22
Copyright (C) 2015 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./john...done.
(gdb) run --test=0 --format=hmac-sha256
Starting program: /home/fd/git/JtR/run/john --test=0 --format=hmac-sha256
Missing separate debuginfos, use: dnf debuginfo-install glibc-2.21-8.fc22.x86_64
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Testing: HMAC-SHA256 [password is key, SHA256 128/128 AVX 4x]... Loaded 5 hashes with 5 different salts to test db from test vectors

Program received signal SIGSEGV, Segmentation fault.
SIMDSHA256body (data=0xf87021, out=0xf869d0, reload_state=0xf86d00, SSEi_flags=40) at simd-intrinsics.c:1826
1826            memcpy(_w, data, 16*sizeof(vtype)*SIMD_PARA_SHA256);
Missing separate debuginfos, use: dnf debuginfo-install gmp-6.0.0-9.fc22.x86_64 keyutils-libs-1.5.9-4.fc22.x86_64 krb5-libs-1.13.2-10.fc22.x86_64 libcom_err-1.42.12-4.fc22.x86_64 libselinux-2.3-10.fc22.x86_64 nss-softokn-freebl-3.21.0-1.1.fc22.x86_64 openssl-libs-1.0.1k-13.fc22.x86_64 pcre-8.37-7.fc22.x86_64 zlib-1.2.8-7.fc22.x86_64
(gdb) 
<!-- gh-comment-id:165295800 --> @frank-dittrich commented on GitHub (Dec 17, 2015): Without ASan, but with UbSan, I get the segfault. ``` $ gdb ./john GNU gdb (GDB) Fedora 7.9.1-20.fc22 Copyright (C) 2015 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-redhat-linux-gnu". Type "show configuration" for configuration details. For bug reporting instructions, please see: <http://www.gnu.org/software/gdb/bugs/>. Find the GDB manual and other documentation resources online at: <http://www.gnu.org/software/gdb/documentation/>. For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from ./john...done. (gdb) run --test=0 --format=hmac-sha256 Starting program: /home/fd/git/JtR/run/john --test=0 --format=hmac-sha256 Missing separate debuginfos, use: dnf debuginfo-install glibc-2.21-8.fc22.x86_64 [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib64/libthread_db.so.1". Testing: HMAC-SHA256 [password is key, SHA256 128/128 AVX 4x]... Loaded 5 hashes with 5 different salts to test db from test vectors Program received signal SIGSEGV, Segmentation fault. SIMDSHA256body (data=0xf87021, out=0xf869d0, reload_state=0xf86d00, SSEi_flags=40) at simd-intrinsics.c:1826 1826 memcpy(_w, data, 16*sizeof(vtype)*SIMD_PARA_SHA256); Missing separate debuginfos, use: dnf debuginfo-install gmp-6.0.0-9.fc22.x86_64 keyutils-libs-1.5.9-4.fc22.x86_64 krb5-libs-1.13.2-10.fc22.x86_64 libcom_err-1.42.12-4.fc22.x86_64 libselinux-2.3-10.fc22.x86_64 nss-softokn-freebl-3.21.0-1.1.fc22.x86_64 openssl-libs-1.0.1k-13.fc22.x86_64 pcre-8.37-7.fc22.x86_64 zlib-1.2.8-7.fc22.x86_64 (gdb) ```
Author
Owner

@magnumripper commented on GitHub (Dec 17, 2015):

Dry running it from the info: The memcpy destination _w is a correctly sized stack array. It could be named _w.w instead because it's a union but it should be fine as-is and no compiler is complaining.

The source is passed from hmac-sha256 format. If it's incorrectly sized, ASan should see it. I tried both OMP and non-OMP build (although with gcc) and no problem seen. So I suspect this is a clang bug.

<!-- gh-comment-id:165392425 --> @magnumripper commented on GitHub (Dec 17, 2015): Dry running it from the info: The memcpy destination `_w` is a correctly sized stack array. It could be named `_w.w` instead because it's a union but it should be fine as-is and no compiler is complaining. The source is passed from hmac-sha256 format. If it's incorrectly sized, ASan should see it. I tried both OMP and non-OMP build (although with gcc) and no problem seen. So I suspect this is a clang bug.
Author
Owner

@jfoug commented on GitHub (Jan 5, 2016):

Please see if the error is seen after applying bcc9c47

<!-- gh-comment-id:169136838 --> @jfoug commented on GitHub (Jan 5, 2016): Please see if the error is seen after applying bcc9c47
Author
Owner

@frank-dittrich commented on GitHub (Jan 5, 2016):

Segfault still occurs:

(bleeding-jumbo)run $ ../run/john --list=build-info && ../run/john --test=0 --format=hmac-sha256
Version: 1.8.0.6-jumbo-1-1819-gbcc9c47
Build: linux-gnu 64-bit AVX-ac
SIMD: AVX, interleaving: MD4:4 MD5:5 SHA1:2 SHA256:1 SHA512:1
$JOHN is ../run/
Format interface version: 13
Max. number of reported tunable costs: 3
Rec file version: REC4
Charset file version: CHR3
CHARSET_MIN: 1 (0x01)
CHARSET_MAX: 255 (0xff)
CHARSET_LENGTH: 24
SALT_HASH_SIZE: 1048576
Max. Markov mode level: 400
Max. Markov mode password length: 30
clang version: 3.5.0 (tags/RELEASE_350/final) (gcc 4.3.0 compatibility)
GNU libc version: 2.21 (loaded: 2.21)
Crypto library: OpenSSL
OpenSSL library version: 0100010bf
OpenSSL 1.0.1k-fips 8 Jan 2015
GMP library version: 6.0.0
Regex library version: 1.3  (loaded: 1.3.1)
File locking: fcntl()
fseek(): fseek
ftell(): ftell
fopen(): fopen
memmem(): System's
Testing: HMAC-SHA256 [password is key, SHA256 128/128 AVX 4x]... Segmentation fault (core dumped)
<!-- gh-comment-id:169139535 --> @frank-dittrich commented on GitHub (Jan 5, 2016): Segfault still occurs: ``` (bleeding-jumbo)run $ ../run/john --list=build-info && ../run/john --test=0 --format=hmac-sha256 Version: 1.8.0.6-jumbo-1-1819-gbcc9c47 Build: linux-gnu 64-bit AVX-ac SIMD: AVX, interleaving: MD4:4 MD5:5 SHA1:2 SHA256:1 SHA512:1 $JOHN is ../run/ Format interface version: 13 Max. number of reported tunable costs: 3 Rec file version: REC4 Charset file version: CHR3 CHARSET_MIN: 1 (0x01) CHARSET_MAX: 255 (0xff) CHARSET_LENGTH: 24 SALT_HASH_SIZE: 1048576 Max. Markov mode level: 400 Max. Markov mode password length: 30 clang version: 3.5.0 (tags/RELEASE_350/final) (gcc 4.3.0 compatibility) GNU libc version: 2.21 (loaded: 2.21) Crypto library: OpenSSL OpenSSL library version: 0100010bf OpenSSL 1.0.1k-fips 8 Jan 2015 GMP library version: 6.0.0 Regex library version: 1.3 (loaded: 1.3.1) File locking: fcntl() fseek(): fseek ftell(): ftell fopen(): fopen memmem(): System's Testing: HMAC-SHA256 [password is key, SHA256 128/128 AVX 4x]... Segmentation fault (core dumped) ```
Author
Owner

@frank-dittrich commented on GitHub (Jan 5, 2016):

(gdb) run --test=0 --format=hmac-sha256
Starting program: /home/fd/git/JtR/run/john --test=0 --format=hmac-sha256
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Testing: HMAC-SHA256 [password is key, SHA256 128/128 AVX 4x]... 
Program received signal SIGSEGV, Segmentation fault.
SIMDSHA256body (data=0xfa3c31, out=0xfa35e0, reload_state=0xfa3910, SSEi_flags=40) at simd-intrinsics.c:1826
1826            memcpy(_w, data, 16*sizeof(vtype)*SIMD_PARA_SHA256);
Missing separate debuginfos, use: dnf debuginfo-install gmp-6.0.0-9.fc22.x86_64 keyutils-libs-1.5.9-4.fc22.x86_64 krb5-libs-1.13.2-10.fc22.x86_64 libcom_err-1.42.12-4.fc22.x86_64 libgcc-5.3.1-2.fc22.x86_64 libselinux-2.3-10.fc22.x86_64 libstdc++-5.3.1-2.fc22.x86_64 openssl-libs-1.0.1k-13.fc22.x86_64 pcre-8.38-1.fc22.x86_64 zlib-1.2.8-7.fc22.x86_64
(gdb) bt
#0  SIMDSHA256body (data=0xfa3c31, out=0xfa35e0, reload_state=0xfa3910, SSEi_flags=40) at simd-intrinsics.c:1826
#1  0x0000000000522b94 in crypt_all (pcount=<optimized out>, salt=0xfa35e0) at hmacSHA256_fmt_plug.c:410
#2  0x00000000005a0a30 in is_key_right (format=0x992380 <fmt_hmacSHA256>, index=0, binary=0xfa3504, 
    ciphertext=0xab60d0 <split.out> "The quick brown fox jumps over the lazy dog#f7bc83f430538424b13298e6aa6fb143ef4d59a14946175997479dbc2d1a3cd8", plaintext=0x6ff261 "key", 
    is_test_fmt_case=0, dbsalt=0xfa35e0) at formats.c:209
#3  0x00000000005a006c in fmt_self_test_body (format=<optimized out>, db=<optimized out>, full_lvl=<optimized out>, binary_copy=<optimized out>, salt_copy=<optimized out>)
    at formats.c:836
#4  fmt_self_test (format=0x992380 <fmt_hmacSHA256>, db=0xfa3550) at formats.c:1593
#5  0x00000000005934f2 in benchmark_format (format=0x992380 <fmt_hmacSHA256>, salts=256, results=0x7fffffffde08, test_db=0xfa35e0) at bench.c:255
#6  0x00000000005940bf in benchmark_all () at bench.c:687
#7  0x00000000005a497e in john_run () at john.c:1587
#8  0x00000000005a4155 in main (argc=3, argv=0x7fffffffe098) at john.c:1973

May be I'll find the time to test a more recent distribution with another clang version within the next days.

<!-- gh-comment-id:169140039 --> @frank-dittrich commented on GitHub (Jan 5, 2016): ``` (gdb) run --test=0 --format=hmac-sha256 Starting program: /home/fd/git/JtR/run/john --test=0 --format=hmac-sha256 [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib64/libthread_db.so.1". Testing: HMAC-SHA256 [password is key, SHA256 128/128 AVX 4x]... Program received signal SIGSEGV, Segmentation fault. SIMDSHA256body (data=0xfa3c31, out=0xfa35e0, reload_state=0xfa3910, SSEi_flags=40) at simd-intrinsics.c:1826 1826 memcpy(_w, data, 16*sizeof(vtype)*SIMD_PARA_SHA256); Missing separate debuginfos, use: dnf debuginfo-install gmp-6.0.0-9.fc22.x86_64 keyutils-libs-1.5.9-4.fc22.x86_64 krb5-libs-1.13.2-10.fc22.x86_64 libcom_err-1.42.12-4.fc22.x86_64 libgcc-5.3.1-2.fc22.x86_64 libselinux-2.3-10.fc22.x86_64 libstdc++-5.3.1-2.fc22.x86_64 openssl-libs-1.0.1k-13.fc22.x86_64 pcre-8.38-1.fc22.x86_64 zlib-1.2.8-7.fc22.x86_64 (gdb) bt #0 SIMDSHA256body (data=0xfa3c31, out=0xfa35e0, reload_state=0xfa3910, SSEi_flags=40) at simd-intrinsics.c:1826 #1 0x0000000000522b94 in crypt_all (pcount=<optimized out>, salt=0xfa35e0) at hmacSHA256_fmt_plug.c:410 #2 0x00000000005a0a30 in is_key_right (format=0x992380 <fmt_hmacSHA256>, index=0, binary=0xfa3504, ciphertext=0xab60d0 <split.out> "The quick brown fox jumps over the lazy dog#f7bc83f430538424b13298e6aa6fb143ef4d59a14946175997479dbc2d1a3cd8", plaintext=0x6ff261 "key", is_test_fmt_case=0, dbsalt=0xfa35e0) at formats.c:209 #3 0x00000000005a006c in fmt_self_test_body (format=<optimized out>, db=<optimized out>, full_lvl=<optimized out>, binary_copy=<optimized out>, salt_copy=<optimized out>) at formats.c:836 #4 fmt_self_test (format=0x992380 <fmt_hmacSHA256>, db=0xfa3550) at formats.c:1593 #5 0x00000000005934f2 in benchmark_format (format=0x992380 <fmt_hmacSHA256>, salts=256, results=0x7fffffffde08, test_db=0xfa35e0) at bench.c:255 #6 0x00000000005940bf in benchmark_all () at bench.c:687 #7 0x00000000005a497e in john_run () at john.c:1587 #8 0x00000000005a4155 in main (argc=3, argv=0x7fffffffe098) at john.c:1973 ``` May be I'll find the time to test a more recent distribution with another clang version within the next days.
Author
Owner

@frank-dittrich commented on GitHub (Jan 5, 2016):

I tried to find out how many times the code in question is processed until the segfault occurs.

Turns out --test=0 is not deterministic.

With GCC (non-openmp), that code is executed between 9037 and 12129 times per --test=0 run, when repeating the same test with exactly the same binary.
(I do expect a varying number of times for --test=1 on my laptop, due to throttling etc., but not for --test=0.)
IMHO, this should not happen for --test=0.

With clang, the segfault occurs during the 3rd time that code is processed.

<!-- gh-comment-id:169143873 --> @frank-dittrich commented on GitHub (Jan 5, 2016): I tried to find out how many times the code in question is processed until the segfault occurs. Turns out --test=0 is not deterministic. With GCC (non-openmp), that code is executed between 9037 and 12129 times per --test=0 run, when repeating the same test with exactly the same binary. (I do expect a varying number of times for --test=1 on my laptop, due to throttling etc., but not for --test=0.) IMHO, this should not happen for --test=0. With clang, the segfault occurs during the 3rd time that code is processed.
Author
Owner

@frank-dittrich commented on GitHub (Jan 10, 2016):

With clang 3.7.0 (Fedora 23), still just claiming gcc 4.2.1 compatibility (just like clang 3.5.0), I cannot reproduce this bug.

<!-- gh-comment-id:170399034 --> @frank-dittrich commented on GitHub (Jan 10, 2016): With clang 3.7.0 (Fedora 23), still just claiming gcc 4.2.1 compatibility (just like clang 3.5.0), I cannot reproduce this bug.
Author
Owner

@frank-dittrich commented on GitHub (Jan 15, 2016):

May be I just wasn't doing exactly the same test with clang 3.7.0, because I installed Fedora 23 on my Hashwell system which has AVX2.

When I try to disable AVX2 like this

./configure CC=clang CFLAGS="-mno-avx2" && make -s clean && make -s -j 8

or

./configure CC=clang CFLAGS_EXTRA="-mno-avx2" && make -s clean && make -s -j 8

I can still not reproduce that bug.

OTOH, when I use

./configure CC=clang CFLAGS="-mno-avx2" && make -s clean && make -s -j 8

on the same AVX system where the bug occurs when not using CFLAGS="-mno-avx2", the bug is gone.

When I use

./configure CC=clang CFLAGS_EXTRA="-mno-avx2" && make -s clean && make -s -j 8

on my AVX system, the segfault occurs.

<!-- gh-comment-id:172105820 --> @frank-dittrich commented on GitHub (Jan 15, 2016): May be I just wasn't doing exactly the same test with clang 3.7.0, because I installed Fedora 23 on my Hashwell system which has AVX2. When I try to disable AVX2 like this ``` ./configure CC=clang CFLAGS="-mno-avx2" && make -s clean && make -s -j 8 ``` or ``` ./configure CC=clang CFLAGS_EXTRA="-mno-avx2" && make -s clean && make -s -j 8 ``` I can still not reproduce that bug. OTOH, when I use ``` ./configure CC=clang CFLAGS="-mno-avx2" && make -s clean && make -s -j 8 ``` on the same AVX system where the bug occurs when not using `CFLAGS="-mno-avx2"`, the bug is gone. When I use ``` ./configure CC=clang CFLAGS_EXTRA="-mno-avx2" && make -s clean && make -s -j 8 ``` on my AVX system, the segfault occurs.
Author
Owner

@kholia commented on GitHub (Mar 8, 2017):

I couldn't build current JtR jumbo with,

./configure CC=clang CFLAGS_EXTRA="-mno-avx2" && make -s clean && make -s -j 8

I am running Fedora 24 with Clang 3.8.1 on a Skylake AVX2 system.

I get errors like,

$ make
...
clang -DAC_BUILT -march=native -mavx2 -DJOHN_AVX2 -c -g -O2 -I/usr/local/include -DARCH_LITTLE_ENDIAN=1 -mno-avx2 ... DES_bs_b.c

DES_bs_b.c:1372:6: error: always_inline function '_mm256_xor_si256' requires target feature 'avx2', but would be inlined into function 'DES_bs_crypt_25' that is compiled without support for 'avx2'

So, I manually patched the Makefile to enable AVX only (not AVX2) and the build succeeded. I changed "DJOHN_AVX2" to "DJOHN_AVX" and "-mavx2" to "-mavx" in the Makefile.

$ ../run/john --list=build-info
Version: v3-3001-g7e31a52
Build: linux-gnu 64-bit AVX2-ac
SIMD: AVX, interleaving: MD4:4 MD5:5 SHA1:2 SHA256:1 SHA512:1
$JOHN is ../run/
Format interface version: 14
Max. number of reported tunable costs: 3
Rec file version: REC4
Charset file version: CHR3
CHARSET_MIN: 1 (0x01)
CHARSET_MAX: 255 (0xff)
CHARSET_LENGTH: 24
SALT_HASH_SIZE: 1048576
Max. Markov mode level: 400
Max. Markov mode password length: 30
clang version: 3.8.1 (tags/RELEASE_381/final) (gcc 4.2.1 compatibility)
GNU libc version: 2.23 (loaded: 2.23)
OpenCL headers version: 1.2
Crypto library: OpenSSL
OpenSSL library version: 0100020bf
OpenSSL 1.0.2k-fips  26 Jan 2017
GMP library version: 6.1.1
File locking: fcntl()
fseek(): fseek
ftell(): ftell
fopen(): fopen
memmem(): System's

../run/john --test=0 --format=hmac-sha256 no longer crashes. Hence I am closing the bug.

<!-- gh-comment-id:285051941 --> @kholia commented on GitHub (Mar 8, 2017): I couldn't build current JtR jumbo with, ``` ./configure CC=clang CFLAGS_EXTRA="-mno-avx2" && make -s clean && make -s -j 8 ``` I am running Fedora 24 with Clang 3.8.1 on a Skylake AVX2 system. I get errors like, ``` $ make ... clang -DAC_BUILT -march=native -mavx2 -DJOHN_AVX2 -c -g -O2 -I/usr/local/include -DARCH_LITTLE_ENDIAN=1 -mno-avx2 ... DES_bs_b.c DES_bs_b.c:1372:6: error: always_inline function '_mm256_xor_si256' requires target feature 'avx2', but would be inlined into function 'DES_bs_crypt_25' that is compiled without support for 'avx2' ``` So, I manually patched the Makefile to enable AVX only (not AVX2) and the build succeeded. I changed "DJOHN_AVX2" to "DJOHN_AVX" and "-mavx2" to "-mavx" in the Makefile. ``` $ ../run/john --list=build-info Version: v3-3001-g7e31a52 Build: linux-gnu 64-bit AVX2-ac SIMD: AVX, interleaving: MD4:4 MD5:5 SHA1:2 SHA256:1 SHA512:1 $JOHN is ../run/ Format interface version: 14 Max. number of reported tunable costs: 3 Rec file version: REC4 Charset file version: CHR3 CHARSET_MIN: 1 (0x01) CHARSET_MAX: 255 (0xff) CHARSET_LENGTH: 24 SALT_HASH_SIZE: 1048576 Max. Markov mode level: 400 Max. Markov mode password length: 30 clang version: 3.8.1 (tags/RELEASE_381/final) (gcc 4.2.1 compatibility) GNU libc version: 2.23 (loaded: 2.23) OpenCL headers version: 1.2 Crypto library: OpenSSL OpenSSL library version: 0100020bf OpenSSL 1.0.2k-fips 26 Jan 2017 GMP library version: 6.1.1 File locking: fcntl() fseek(): fseek ftell(): ftell fopen(): fopen memmem(): System's ``` `../run/john --test=0 --format=hmac-sha256` no longer crashes. Hence I am closing the bug.
Author
Owner

@magnumripper commented on GitHub (Mar 8, 2017):

./configure CC=clang CFLAGS_EXTRA="-mno-avx2"

Just for reference, whenever disabling functionality like this you also need the --disable-native-tests option to configure.

<!-- gh-comment-id:285053764 --> @magnumripper commented on GitHub (Mar 8, 2017): > ./configure CC=clang CFLAGS_EXTRA="-mno-avx2" Just for reference, whenever disabling functionality like this you also need the `--disable-native-tests` option to configure.
Author
Owner

@kholia commented on GitHub (Mar 8, 2017):

Thanks, good to know!

<!-- gh-comment-id:285059507 --> @kholia commented on GitHub (Mar 8, 2017): Thanks, good to know!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
openwall/john#1301
No description provided.