[GH-ISSUE #1078] raw-sha1-ng: self test fail (only seen with ASan + -DDEBUG) #673

Closed
opened 2026-10-14 03:18:52 +07:00 by bsakaguchi · 9 comments
Owner

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

Originally assigned to: @frank-dittrich on GitHub.

64bit Linux debug build:

(bleeding-jumbo)run $ ./john --test=0 --format=raw-sha1-ng
Will run 8 OpenMP threads
Testing: Raw-SHA1-ng, (pwlen <= 15) [SHA1 128/128 AVX 4x]... (8xOMP) FAILED (cmp_all(61448))

Originally created by @frank-dittrich on GitHub (Mar 7, 2015). Original GitHub issue: https://github.com/openwall/john/issues/1078 Originally assigned to: @frank-dittrich on GitHub. 64bit Linux debug build: ``` (bleeding-jumbo)run $ ./john --test=0 --format=raw-sha1-ng Will run 8 OpenMP threads Testing: Raw-SHA1-ng, (pwlen <= 15) [SHA1 128/128 AVX 4x]... (8xOMP) FAILED (cmp_all(61448)) ```
bsakaguchi 2026-10-14 03:18:52 +07:00
Author
Owner

@jfoug commented on GitHub (Mar 9, 2015):

@magnumripper do you have any idea how make debug build would do this for a format like this? I see no DEBUG defines at all in this format.

<!-- gh-comment-id:77948681 --> @jfoug commented on GitHub (Mar 9, 2015): @magnumripper do you have any idea how make debug build would do this for a format like this? I see no DEBUG defines at all in this format.
Author
Owner

@magnumripper commented on GitHub (Mar 9, 2015):

The only reason I can think of is a bug hiding in there that is revealed because of the different mem_alloc_tiny or something like that. But that usually would result in segfault or ASAN crash.

<!-- gh-comment-id:77957429 --> @magnumripper commented on GitHub (Mar 9, 2015): The only reason I can think of is a bug hiding in there that is revealed because of the different mem_alloc_tiny or something like that. But that usually would result in segfault or ASAN crash.
Author
Owner

@magnumripper commented on GitHub (Mar 9, 2015):

Two observations: First, I can't reproduce. Another thing, when I run this with a debug build I get a text mentioning that:

$ ../run/john -test -form:raw-sha1-ng 
Will run 8 OpenMP threads
NOTE: This is a debug build, figures might be lower than normal
Benchmarking: Raw-SHA1-ng, (pwlen <= 15) [SHA1 128/128 AVX 4x]... (8xOMP) DONE
Raw:    6078K c/s real, 821607 c/s virtual
<!-- gh-comment-id:77958217 --> @magnumripper commented on GitHub (Mar 9, 2015): Two observations: First, I can't reproduce. Another thing, when I run this with a debug build I get a text mentioning that: ``` $ ../run/john -test -form:raw-sha1-ng Will run 8 OpenMP threads NOTE: This is a debug build, figures might be lower than normal Benchmarking: Raw-SHA1-ng, (pwlen <= 15) [SHA1 128/128 AVX 4x]... (8xOMP) DONE Raw: 6078K c/s real, 821607 c/s virtual ```
Author
Owner

@magnumripper commented on GitHub (Mar 9, 2015):

OK, that debug message is not shown with -test=0, that's why.

<!-- gh-comment-id:77959416 --> @magnumripper commented on GitHub (Mar 9, 2015): OK, that debug message is not shown with `-test=0`, that's why.
Author
Owner

@magnumripper commented on GitHub (Mar 9, 2015):

OK, I've seen it once now, using ASAN + debug. No ASAN crash.

$ ../run/john -stress-test=0 -form:raw-sha1-ng 
Will run 8 OpenMP threads
Testing: Raw-SHA1-ng, (pwlen <= 15) [SHA1 128/128 AVX 4x]... (8xOMP) PASS
Testing: Raw-SHA1-ng, (pwlen <= 15) [SHA1 128/128 AVX 4x]... (8xOMP) PASS
Testing: Raw-SHA1-ng, (pwlen <= 15) [SHA1 128/128 AVX 4x]... (8xOMP) PASS
Testing: Raw-SHA1-ng, (pwlen <= 15) [SHA1 128/128 AVX 4x]... (8xOMP) PASS
Testing: Raw-SHA1-ng, (pwlen <= 15) [SHA1 128/128 AVX 4x]... (8xOMP) PASS
Testing: Raw-SHA1-ng, (pwlen <= 15) [SHA1 128/128 AVX 4x]... (8xOMP) FAILED (cmp_all(138256))

Testing: Raw-SHA1-ng, (pwlen <= 15) [SHA1 128/128 AVX 4x]... (8xOMP) PASS
Testing: Raw-SHA1-ng, (pwlen <= 15) [SHA1 128/128 AVX 4x]... (8xOMP) PASS
Testing: Raw-SHA1-ng, (pwlen <= 15) [SHA1 128/128 AVX 4x]... (8xOMP) PASS
^CSession aborted-ng, (pwlen <= 15) [SHA1 128/128 AVX 4x]... (8xOMP) ^CWait...
<!-- gh-comment-id:77959679 --> @magnumripper commented on GitHub (Mar 9, 2015): OK, I've seen it once now, using ASAN + debug. No ASAN crash. ``` $ ../run/john -stress-test=0 -form:raw-sha1-ng Will run 8 OpenMP threads Testing: Raw-SHA1-ng, (pwlen <= 15) [SHA1 128/128 AVX 4x]... (8xOMP) PASS Testing: Raw-SHA1-ng, (pwlen <= 15) [SHA1 128/128 AVX 4x]... (8xOMP) PASS Testing: Raw-SHA1-ng, (pwlen <= 15) [SHA1 128/128 AVX 4x]... (8xOMP) PASS Testing: Raw-SHA1-ng, (pwlen <= 15) [SHA1 128/128 AVX 4x]... (8xOMP) PASS Testing: Raw-SHA1-ng, (pwlen <= 15) [SHA1 128/128 AVX 4x]... (8xOMP) PASS Testing: Raw-SHA1-ng, (pwlen <= 15) [SHA1 128/128 AVX 4x]... (8xOMP) FAILED (cmp_all(138256)) Testing: Raw-SHA1-ng, (pwlen <= 15) [SHA1 128/128 AVX 4x]... (8xOMP) PASS Testing: Raw-SHA1-ng, (pwlen <= 15) [SHA1 128/128 AVX 4x]... (8xOMP) PASS Testing: Raw-SHA1-ng, (pwlen <= 15) [SHA1 128/128 AVX 4x]... (8xOMP) PASS ^CSession aborted-ng, (pwlen <= 15) [SHA1 128/128 AVX 4x]... (8xOMP) ^CWait... ```
Author
Owner

@magnumripper commented on GitHub (Mar 9, 2015):

Using only "debug" I can't see the problem. Using only ASAN, I can't see the problem. Using both, I can.

I decreased OMP_SCALE to 1 and did this

@@ -260,8 +260,11 @@ static void sha1_fmt_init(struct fmt_main *self)
        self->params.max_keys_per_crypt *= omp_t;
 #endif

+    if (!M)
     M   = mem_calloc_tiny(sizeof(*M)  * self->params.max_keys_per_crypt, MEM_ALIGN_SIMD);
+    if (!N)
     N   = mem_calloc_tiny(sizeof(*N)  * self->params.max_keys_per_crypt, MEM_ALIGN_SIMD);
+    if (!MD)
     MD  = mem_calloc_tiny(sizeof(*MD) * self->params.max_keys_per_crypt, MEM_ALIGN_SIMD);
 }

I still get the problem, but only after hundreds of --stress-test=0 iterations (the patch above is needed to avoid a memory leak with --stress-test).

I have yet to see it with OMP_NUM_THREADS=1

<!-- gh-comment-id:77962865 --> @magnumripper commented on GitHub (Mar 9, 2015): Using only "debug" I can't see the problem. Using only ASAN, I can't see the problem. Using both, I can. I decreased OMP_SCALE to 1 and did this ``` @@ -260,8 +260,11 @@ static void sha1_fmt_init(struct fmt_main *self) self->params.max_keys_per_crypt *= omp_t; #endif + if (!M) M = mem_calloc_tiny(sizeof(*M) * self->params.max_keys_per_crypt, MEM_ALIGN_SIMD); + if (!N) N = mem_calloc_tiny(sizeof(*N) * self->params.max_keys_per_crypt, MEM_ALIGN_SIMD); + if (!MD) MD = mem_calloc_tiny(sizeof(*MD) * self->params.max_keys_per_crypt, MEM_ALIGN_SIMD); } ``` I still get the problem, but only after hundreds of --stress-test=0 iterations (the patch above is needed to avoid a memory leak with --stress-test). I have yet to see it with OMP_NUM_THREADS=1
Author
Owner

@magnumripper commented on GitHub (Mar 9, 2015):

I'm using gcc 4.9.2. @frank-dittrich what compiler did you use? Are you sure ASAN wasn't active?

<!-- gh-comment-id:77964454 --> @magnumripper commented on GitHub (Mar 9, 2015): I'm using gcc 4.9.2. @frank-dittrich what compiler did you use? Are you sure ASAN wasn't active?
Author
Owner

@frank-dittrich commented on GitHub (Mar 9, 2015):

All this is on a 64bit fedora 20 system

Just now I can only reproduce this way:

(bleeding-jumbo)src $ make -s distclean 
(bleeding-jumbo)src $ ./configure --enable-asan && make -s -j 16 debug
(bleeding-jumbo)run $ ./john --test=0 --format=raw-sha1-ng 
Will run 8 OpenMP threads
Testing: Raw-SHA1-ng, (pwlen <= 15) [SHA1 128/128 AVX 4x]... (8xOMP) FAILED (cmp_all(475))

(bleeding-jumbo)run $ ./john --test=0 --format=raw-sha1-ng 
Will run 8 OpenMP threads
Testing: Raw-SHA1-ng, (pwlen <= 15) [SHA1 128/128 AVX 4x]... (8xOMP) FAILED (cmp_all(712))

(bleeding-jumbo)run $ ./john --test=0 --format=raw-sha1-ng 
Will run 8 OpenMP threads
Testing: Raw-SHA1-ng, (pwlen <= 15) [SHA1 128/128 AVX 4x]... (8xOMP) PASS
(bleeding-jumbo)run $ ./john --test=0 --format=raw-sha1-ng 
Will run 8 OpenMP threads
Testing: Raw-SHA1-ng, (pwlen <= 15) [SHA1 128/128 AVX 4x]... (8xOMP) FAILED (cmp_all(1574804))

(bleeding-jumbo)run $ ./john --test=0 --format=raw-sha1-ng 
Will run 8 OpenMP threads
Testing: Raw-SHA1-ng, (pwlen <= 15) [SHA1 128/128 AVX 4x]... (8xOMP) PASS
(bleeding-jumbo)run $ ./john --stress-test=0 --format=raw-sha1-ng 
Will run 8 OpenMP threads
Testing: Raw-SHA1-ng, (pwlen <= 15) [SHA1 128/128 AVX 4x]... (8xOMP) FAILED (cmp_all(1049870))

Testing: Raw-SHA1-ng, (pwlen <= 15) [SHA1 128/128 AVX 4x]... (8xOMP) FAILED (cmp_all(1600))

Testing: Raw-SHA1-ng, (pwlen <= 15) [SHA1 128/128 AVX 4x]... (8xOMP) PASS
Testing: Raw-SHA1-ng, (pwlen <= 15) [SHA1 128/128 AVX 4x]... (8xOMP) PASS
Testing: Raw-SHA1-ng, (pwlen <= 15) [SHA1 128/128 AVX 4x]... (8xOMP) ^CWait...
Session aborted
(bleeding-jumbo)run $ ./john --list=build-info 
Version: 1.8.0.2-jumbo-1-bleeding_omp_dbg_asan
Build: linux-gnu 64-bit AVX-autoconf
Arch: 64-bit LE
$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
Max. Markov mode level: 400
Max. Markov mode password length: 30
File locking: fcntl()
Compiler version: 4.8.3 20140911 (Red Hat 4.8.3-7)
gcc version: 4.8.3
OpenSSL library version: 01000105f
OpenSSL 1.0.1e-fips 11 Feb 2013
GMP library version: 5.1.2
Regex library version: 1.2  (loaded: 1.2.3)
fseek(): fseek
ftell(): ftell
fopen(): fopen
memmem(): System's

Built with these debugging options
    '#define DEBUG' set
    ASan (Address Sanitizer debugging)

I try to find other combinations.

<!-- gh-comment-id:77966278 --> @frank-dittrich commented on GitHub (Mar 9, 2015): All this is on a 64bit fedora 20 system Just now I can only reproduce this way: ``` (bleeding-jumbo)src $ make -s distclean (bleeding-jumbo)src $ ./configure --enable-asan && make -s -j 16 debug ``` ``` (bleeding-jumbo)run $ ./john --test=0 --format=raw-sha1-ng Will run 8 OpenMP threads Testing: Raw-SHA1-ng, (pwlen <= 15) [SHA1 128/128 AVX 4x]... (8xOMP) FAILED (cmp_all(475)) (bleeding-jumbo)run $ ./john --test=0 --format=raw-sha1-ng Will run 8 OpenMP threads Testing: Raw-SHA1-ng, (pwlen <= 15) [SHA1 128/128 AVX 4x]... (8xOMP) FAILED (cmp_all(712)) (bleeding-jumbo)run $ ./john --test=0 --format=raw-sha1-ng Will run 8 OpenMP threads Testing: Raw-SHA1-ng, (pwlen <= 15) [SHA1 128/128 AVX 4x]... (8xOMP) PASS (bleeding-jumbo)run $ ./john --test=0 --format=raw-sha1-ng Will run 8 OpenMP threads Testing: Raw-SHA1-ng, (pwlen <= 15) [SHA1 128/128 AVX 4x]... (8xOMP) FAILED (cmp_all(1574804)) (bleeding-jumbo)run $ ./john --test=0 --format=raw-sha1-ng Will run 8 OpenMP threads Testing: Raw-SHA1-ng, (pwlen <= 15) [SHA1 128/128 AVX 4x]... (8xOMP) PASS (bleeding-jumbo)run $ ./john --stress-test=0 --format=raw-sha1-ng Will run 8 OpenMP threads Testing: Raw-SHA1-ng, (pwlen <= 15) [SHA1 128/128 AVX 4x]... (8xOMP) FAILED (cmp_all(1049870)) Testing: Raw-SHA1-ng, (pwlen <= 15) [SHA1 128/128 AVX 4x]... (8xOMP) FAILED (cmp_all(1600)) Testing: Raw-SHA1-ng, (pwlen <= 15) [SHA1 128/128 AVX 4x]... (8xOMP) PASS Testing: Raw-SHA1-ng, (pwlen <= 15) [SHA1 128/128 AVX 4x]... (8xOMP) PASS Testing: Raw-SHA1-ng, (pwlen <= 15) [SHA1 128/128 AVX 4x]... (8xOMP) ^CWait... Session aborted ``` ``` (bleeding-jumbo)run $ ./john --list=build-info Version: 1.8.0.2-jumbo-1-bleeding_omp_dbg_asan Build: linux-gnu 64-bit AVX-autoconf Arch: 64-bit LE $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 Max. Markov mode level: 400 Max. Markov mode password length: 30 File locking: fcntl() Compiler version: 4.8.3 20140911 (Red Hat 4.8.3-7) gcc version: 4.8.3 OpenSSL library version: 01000105f OpenSSL 1.0.1e-fips 11 Feb 2013 GMP library version: 5.1.2 Regex library version: 1.2 (loaded: 1.2.3) fseek(): fseek ftell(): ftell fopen(): fopen memmem(): System's Built with these debugging options '#define DEBUG' set ASan (Address Sanitizer debugging) ``` I try to find other combinations.
Author
Owner

@magnumripper commented on GitHub (Mar 10, 2015):

Until we can trigger any problem without Asan + -DDEBUG I downgraded this to an "external issue"

<!-- gh-comment-id:78162533 --> @magnumripper commented on GitHub (Mar 10, 2015): Until we can trigger any problem without Asan + -DDEBUG I downgraded this to an "external issue"
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#673
No description provided.