[GH-ISSUE #586] raw-sha1-ng intermittently fails in OMP builds #257

Closed
opened 2026-10-14 02:58:56 +07:00 by bsakaguchi · 9 comments
Owner

Originally created by @magnumripper on GitHub (May 16, 2014).
Original GitHub issue: https://github.com/openwall/john/issues/586

It's very intermittent, and it's only in OMP (or extremely rare without OMP?)

$ ../run/john -te   -form=Raw-SHA1-ng
Will run 6 OpenMP threads
Benchmarking: Raw-SHA1-ng, (pwlen <= 15) [SHA1 128/128 SSE2 4x]... (6xOMP) FAILED (cmp_all(212))

(this from #575)

Originally created by @magnumripper on GitHub (May 16, 2014). Original GitHub issue: https://github.com/openwall/john/issues/586 It's very intermittent, and it's only in OMP (or extremely rare without OMP?) ``` $ ../run/john -te -form=Raw-SHA1-ng Will run 6 OpenMP threads Benchmarking: Raw-SHA1-ng, (pwlen <= 15) [SHA1 128/128 SSE2 4x]... (6xOMP) FAILED (cmp_all(212)) ``` (this from #575)
bsakaguchi 2026-10-14 02:58:56 +07:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@ghost commented on GitHub (May 17, 2014):

2 threads seems to be Ok too.

OMP_NUM_THREADS=2 ../run/john -te   -form=Raw-SHA1-ng

3 threads fails sometimes and works other times. More than 3 seems to fail always.

OMP_NUM_THREADS=3 ../run/john -te   -form=Raw-SHA1-ng
<!-- gh-comment-id:43393148 --> @ghost commented on GitHub (May 17, 2014): 2 threads seems to be Ok too. ``` OMP_NUM_THREADS=2 ../run/john -te -form=Raw-SHA1-ng ``` 3 threads fails sometimes and works other times. More than 3 seems to fail always. ``` OMP_NUM_THREADS=3 ../run/john -te -form=Raw-SHA1-ng ```
Author
Owner

@ghost commented on GitHub (May 17, 2014):

I cannot reproduce this on bleeding. I mean, bleeding-jumbo seems to work fine (more on #575 later).

<!-- gh-comment-id:43393273 --> @ghost commented on GitHub (May 17, 2014): I cannot reproduce this on bleeding. I mean, bleeding-jumbo seems to work fine (more on #575 later).
Author
Owner

@ghost commented on GitHub (May 17, 2014):

I am able to fix it on autoconf. Below, from an autoconf generated Makefile:

# -m64 left out
CPPFLAGS += 
CFLAGSX = -DAC_BUILT $(CPPFLAGS) -c -Wall -Wdeclaration-after-statement  -I/usr/local/include -I/opt/AMDAPP/include     -fopenmp  -fomit-frame-pointer -I/usr/local/include $(AMDAPP) $(RELEASE_BLD)
# CFLAGS for use on the main john.c file only
CFLAGS_MAIN =  $(CFLAGSX)
CFLAGS = -march=native -msse2 $(CFLAGSX)
ASFLAGS =  -march=native -msse2 -c -fopenmp  
LIBS = -lrt -lpthread -lnsl -ldl -lkrb5 -lk5crypto -lcrypt -lz -lm   -lssl -lcrypto  
LDFLAGS = -g  -L/usr/local/lib -L/opt/AMDAPP/lib $(LIBS) -fopenmp 
LDFLAGS_MKV = -g -fopenmp
#

Some questions:

  • -I/usr/local/include appears twice on CFLAGS. Any reason?
  • -march=native not necessary on LDFLAGS?
  • Why $(AMDAPP) is on CFLAGS? What does it mean?
  • to fix the problem, I changed CFLAGS. Does it make sense to you guys?
    • CPPFLAGS += -O2

After this, SHA1-ng seems to be working as expected.

$ ../run/john -te   -form=Raw-SHA1-ng
Will run 6 OpenMP threads
Benchmarking: Raw-SHA1-ng, (pwlen <= 15) [SHA1 128/128 SSE2 4x]... (6xOMP) DONE
Raw:    32644K c/s real, 7655K c/s virtual
<!-- gh-comment-id:43395666 --> @ghost commented on GitHub (May 17, 2014): I am able to fix it on autoconf. Below, from an autoconf generated Makefile: ``` # -m64 left out CPPFLAGS += CFLAGSX = -DAC_BUILT $(CPPFLAGS) -c -Wall -Wdeclaration-after-statement -I/usr/local/include -I/opt/AMDAPP/include -fopenmp -fomit-frame-pointer -I/usr/local/include $(AMDAPP) $(RELEASE_BLD) # CFLAGS for use on the main john.c file only CFLAGS_MAIN = $(CFLAGSX) CFLAGS = -march=native -msse2 $(CFLAGSX) ASFLAGS = -march=native -msse2 -c -fopenmp LIBS = -lrt -lpthread -lnsl -ldl -lkrb5 -lk5crypto -lcrypt -lz -lm -lssl -lcrypto LDFLAGS = -g -L/usr/local/lib -L/opt/AMDAPP/lib $(LIBS) -fopenmp LDFLAGS_MKV = -g -fopenmp # ``` Some questions: - -I/usr/local/include appears twice on CFLAGS. Any reason? - -march=native not necessary on LDFLAGS? - Why $(AMDAPP) is on CFLAGS? What does it mean? - to fix the problem, I changed CFLAGS. Does it make sense to you guys? - CPPFLAGS += -O2 After this, SHA1-ng seems to be working as expected. ``` $ ../run/john -te -form=Raw-SHA1-ng Will run 6 OpenMP threads Benchmarking: Raw-SHA1-ng, (pwlen <= 15) [SHA1 128/128 SSE2 4x]... (6xOMP) DONE Raw: 32644K c/s real, 7655K c/s virtual ```
Author
Owner

@magnumripper commented on GitHub (May 17, 2014):

$(AMDAPP) would resolve to that variable, which might come from environment.

CPPFLAGS+=O2 would be a no-op as far as I'm aware.

What exact CFLAGS did you end up with that worked? Was -march=native required in LDFLAGS? It should not be needed.

<!-- gh-comment-id:43418427 --> @magnumripper commented on GitHub (May 17, 2014): $(AMDAPP) would resolve to that variable, which might come from environment. CPPFLAGS+=O2 would be a no-op as far as I'm aware. What exact CFLAGS did you end up with that worked? Was -march=native required in LDFLAGS? It should not be needed.
Author
Owner

@jfoug commented on GitHub (May 17, 2014):

If this was simply lack of the -O2 flag, that has now been added. Please make sure the current configure (without doing hand edits), works properly for you.

<!-- gh-comment-id:43418762 --> @jfoug commented on GitHub (May 17, 2014): If this was simply lack of the -O2 flag, that has now been added. Please make sure the current configure (without doing hand edits), works properly for you.
Author
Owner

@jfoug commented on GitHub (May 17, 2014):

NOTE, $(AMDAPP) was removed, in the 2nd to latest Makefile.in. I thought this was a carry over, and not required, since we are handling this type stuff in configure. If this needs to be re-added, that is a trivial change to Makefile.in

<!-- gh-comment-id:43420306 --> @jfoug commented on GitHub (May 17, 2014): NOTE, $(AMDAPP) was removed, in the 2nd to latest Makefile.in. I thought this was a carry over, and not required, since we are handling this type stuff in configure. If this needs to be re-added, that is a trivial change to Makefile.in
Author
Owner

@ghost commented on GitHub (May 17, 2014):

It is working now.

$(AMDAPP) was removed, in the 2nd to latest Makefile.in. I thought this was a carry over

I agree.

If this was simply lack of the -O2 flag

Yes, I only added -O2 flag and it worked fine (as it doing now).

<!-- gh-comment-id:43421926 --> @ghost commented on GitHub (May 17, 2014): It is working now. > $(AMDAPP) was removed, in the 2nd to latest Makefile.in. I thought this was a carry over I agree. > If this was simply lack of the -O2 flag Yes, I only added -O2 flag and it worked fine (as it doing now).
Author
Owner

@magnumripper commented on GitHub (May 18, 2014):

We should definitely use -O2 but otoh I see absolutely no reason it should fail self-test without it! Anyway, closing this for now.

<!-- gh-comment-id:43436022 --> @magnumripper commented on GitHub (May 18, 2014): We should definitely use -O2 but otoh I see absolutely no reason it should fail self-test without it! Anyway, closing this for now.
Author
Owner

@jfoug commented on GitHub (May 18, 2014):

The 'extra' command switches do NOT become part of CFLAGS. They are passed in as a separate @CFLAGS_EXTRA@ replacement to Makefile.in. We may also need to compute some unique switches within the triplet parsing code, or even possibly simply blindly set them. Again, my 'does this work' logic depends upon the -Werror flag. If the compiler on some of these other systems is not gcc, then that detection method may not work. NOTE, I have not tried on sparc yet, and moreover on sparc's cc yet. I will do so in a few days.

<!-- gh-comment-id:43437724 --> @jfoug commented on GitHub (May 18, 2014): The 'extra' command switches do NOT become part of CFLAGS. They are passed in as a separate @CFLAGS_EXTRA@ replacement to Makefile.in. We may also need to compute some unique switches within the triplet parsing code, or even possibly simply blindly set them. Again, my 'does this work' logic depends upon the -Werror flag. If the compiler on some of these other systems is not gcc, then that detection method may not work. NOTE, I have not tried on sparc yet, and moreover on sparc's cc yet. I will do so in a few days.
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#257
No description provided.