mirror of
https://github.com/openwall/john.git
synced 2026-12-03 18:45:21 +07:00
[GH-ISSUE #1437] some dynamic formats malfunction on MIC #922
Labels
No labels
bug
core branch
documentation
enhancement
enhancement
fixed - pending verify
fuzz bug
good first issue
invalid
invalid
maintenance/cleanup
new cracking mode
new format
new tool
non-trivial
notes/external issues
portability
question
RFC / discussion
testing
WONTFIX
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
openwall/john#922
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @lei-april on GitHub (Jun 14, 2015).
Original GitHub issue: https://github.com/openwall/john/issues/1437
Originally assigned to: @lei-april on GitHub.
dynamic_30 core dumps on MIC, resulting from the following code:
corresponding allocation code:
dynamic_31, dynamic_32 and so on fail self-test on MIC.
@lei-april commented on GitHub (Jun 15, 2015):
BTW, I tried replacing
mem_calloc_alignandMEM_FREEwith icc's builtin_mm_mallocand_mm_freerespectively. Yet it still segfaults on those freeing code. I think it's not something wrong withmem_calloc_alignorMEM_FREE.@magnumripper commented on GitHub (Jun 15, 2015):
Sounds like a buffer overrun. Perhaps the pointer is overwritten with garbage, that will definitely cause a segfault when freeing.
dynamic_31 through dynamic_33 are MD4 (see
../run/john --list=subformats). Does dynamic_34 work?The cause is likely some multiplier/divisor that does not work well with your combination of SIMD_COEF_32 and SIMD_PARA_MD4.
@lei-april commented on GitHub (Jun 16, 2015):
Perhaps not. I manually checked the value of
crypt_key2after allocation and that before freeing, which two are the same. And freeingcrypt_key2core-dumps immediately.Yes, it works, but also core-dumps in the epilogue.
It looks you're right. Setting
SIMD_PARA_MD4to 1 (which is originally 6) just erases all the problems. I tried some other values, while some make dynamic_30 work but make dynamic_31 fail, and some vice versa.@magnumripper commented on GitHub (Jun 16, 2015):
So perhaps
2da5ccba(or something similar) is not doing the trick fully. It "handles paras up to 7" but does it handle a coef of 16 at the same time as a para of 6?@magnumripper commented on GitHub (Jun 16, 2015):
We also have this perhaps problematic code in dynamic_types.h
It ensures an even multiple for MD5, but not for any other hash type. @jfoug what do you think?
@lei-april commented on GitHub (Jun 16, 2015):
Doubling
NON_OMP_MAXfrom 1680 to 3360 makes dynamic_30 work with paras up to 7. But dynamic_31 to dynamic_33 still fail, all with the same output:FAILED (cmp_all(64))@jfoug commented on GitHub (Jun 16, 2015):
Can you try again multiplying by 4, not 2. You are switching from COEF==4 to COEF==16 (4x more candidates)
@lei-april commented on GitHub (Jun 17, 2015):
@jfoug No, it still doesn't work for dynamic_31 to dynamic_33, not even with
NON_OMP_MAXassigned the same value asOMP_MAX.@magnumripper commented on GitHub (Jun 17, 2015):
I bet the problem is not the coef of 16 but the para of 6. The actual keys-per-batch from the intrinsics function is 96. What is the output of
../run/john --list=format-all-details --format=dynamic_31?@lei-april commented on GitHub (Jun 17, 2015):
Not necessarily. dynamic_31 fails on lower paras too.
@magnumripper commented on GitHub (Jun 17, 2015):
But it works with para 1, right?
@jfoug commented on GitHub (Jun 17, 2015):
What exactly are the md5-para, md4-para, sha1-para and simd_coef values for a build that fails?
I 'should' be able to replicate this problem and fix it.
@lei-april commented on GitHub (Jun 18, 2015):
Yes.
@lei-april commented on GitHub (Jun 18, 2015):
md4-para = any value higher than 1
md5-para = 1
sha1-para = 1
coef-32 = 16
@lei-april commented on GitHub (Jun 18, 2015):
I find that dynamic_31 works when
NON_OMP_MAX = 6720and SIMD_PARA_MD5 = SIMD_PARA_MD4 = whatever value. But I don't know why.@lei-april commented on GitHub (Jul 2, 2015):
I reverted to some older commits and tested them on MIC with SIMD_PARA_MD4 > 1 (or MD4_SSE_PARA > 1), and dynamic_31-33 all failed. I think those dynamic formats never worked properly on MIC with interleaving.
@lei-april commented on GitHub (Jul 16, 2015):
I think I found the culprit:
dynamic_fmt.c
Simply replacing
SIMD_PARA_MD5withSIMD_PARA_MD4here would erase all issues encountered previously in this thread. But of course that renders other dynamic formats that rely on MD5 not working.A strange thing is that this function gets invoked both by code for MD4 and code for MD5, but only
SIMD_PARA_MD5is used here. It's even stranger that never caused problem on other platforms (non-MIC).A possible fix is to make two versions of this function, one for MD4 and one for MD5. But I think there may be a better fix.
@jfoug commented on GitHub (Jul 16, 2015):
I will simply make 2 functions, easy enough. That code had not been touched for a LONG time. I think on most builds up to now, md5/md4 para was usually the same, so this never showed up.
@jfoug commented on GitHub (Jul 16, 2015):
Please test. I have no way of knowing if this corrected things. It does work on my AVX2 build and on SSE4.1 build.
@lei-april commented on GitHub (Jul 16, 2015):
NON_OMP_MAXin dynamic_types.h should be at least 6720 (currently 1680) to work on MIC when para is 4.And I just tested SIMD_PARA_MD5 = 4 on well (AVX2) with
NON_OMP_MAXunaltered (1680), which also gave me a bunch of segfaults. I think this piece of code is never thoroughly tested. We're just lucky that the paras chosen so far happened to work.@lei-april commented on GitHub (Jul 16, 2015):
Unfortunately, dynamic_1007 still segfaults on MIC with whatever paras I chose.
@frank-dittrich commented on GitHub (Jul 16, 2015):
@zzlei SInce Jim can't reproduce this, he might want to see the backtrace.
@jfoug commented on GitHub (Jul 16, 2015):
Please test again, after
7971927@lei-april commented on GitHub (Jul 16, 2015):
I think there's something else wrong with dynamic_1007. It still segfaults after
github.com/magnumripper/JohnTheRipper@79719273ae.@jfoug commented on GitHub (Jul 16, 2015):
I do not understand the problem. The script is the same for dynamic_6 and dynamic_1007. In your dynamic.conf, please comment this line out of the 1007
#SaltLenX86=-64
Other than that, these formats should be 100% the same, AND since this is MIC, then I would think the above flag would be ignored anyway. There really should be no differences.
On a 2nd item, can you comment out the test lines, and replace them with the test vectors from dyna_6 and see if that helps.
If either of these help, then it may show some underlying issue in the dyna-6/1007 code. But I just do not see how.
@lei-april commented on GitHub (Jul 16, 2015):
According to the backtrace, the segfault happened in some OpenMP library function. I guess there's something wrong with the OpenMP library used. I rebuilt with a newer version of icc and libiomp, and the problem was gone. At least for
SIMD_PARA_MD4 = 5andSIMD_PARA_MD5 = 4, no dynamic format fails or segfaults anymore. I'll test against other combinations of paras.@lei-april commented on GitHub (Jul 16, 2015):
I think this issue is solved.
@magnumripper commented on GitHub (Jul 16, 2015):
@zzlei for future reference please state versions of the failing icc/lib as well as the working ones.
@lei-april commented on GitHub (Jul 17, 2015):
Strangely, somehow I cannot reproduce dynamic_1007's error...
I previously tested this on super and got this error. Then I move to my lab's machine, where a newer version of icc is installed (bundled with libiomp), and found the error gone. So I thought there must be something wrong with the older libiomp used on super.
Just now I went back to super and re-transfered libiomp to MIC, and the error was also gone. libiomp here should be the same one as before (I don't have the permission to upgrade icc on super). I really don't know how re-transfering the lib solved the problem. Maybe I did something else wrong, but I couldn't remember...