mirror of
https://github.com/openwall/john.git
synced 2026-12-03 18:45:21 +07:00
[GH-ISSUE #860] add --with-asan to configure #465
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#465
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 @jfoug on GitHub (Nov 22, 2014).
Original GitHub issue: https://github.com/openwall/john/issues/860
Asked by @kholia in another thread. Just here so no one forgets.
@kholia do you know of ANY package, where this is in the configure already?
@kholia commented on GitHub (Dec 17, 2014):
@jfoug @magnumripper I tried to get this working in https://github.com/kholia/JohnTheRipper/tree/ASan but no luck, so far.
@jfoug commented on GitHub (Dec 17, 2014):
I posted line comments on your commit. What you have is close. However, where you tried to tie it into CFLAGS, those CFLAGS were just a temp transient setting, and were undone shortly after.
I am not sure we want to add this one to J1. I would rather see it get some testing from the people asking for it, prior to releasing it to general pub. ALSO, if there are issues ASAN is showing, then we should get all those fixed so that it works 'clean' before sending it out to the world, AND there appears to be issues.
@kholia commented on GitHub (Dec 17, 2014):
I would love to see this in J1. I am already trying to fix the issues as we speak.
@jfoug commented on GitHub (Dec 17, 2014):
If we can get a fully 'clean' run prior to J1, then I see no problem adding this.
However, we 'should' enhance it some (checking for the libs checking for -fsanitize=address being valid for the compiler, etc). I guess we can leave it like it is, to blindly set it, and know that it is for a 'serious' developer. BUT note, this is a new 'feature', and those can and almost always DO bite you in the ass.
@kholia commented on GitHub (Dec 17, 2014):
I wouldn't worry too much about this patch. It's not the default and it is meant to be used by "hardcore" developers only ;)
@jfoug commented on GitHub (Dec 17, 2014):
Yes, BUT it shows up on ./configure --help TRUST ME, the more stupid the user, the more likely you will hear from them because they enable this and can not figure out why JtR will not run for them.
@frank-dittrich commented on GitHub (Dec 17, 2014):
At least the description has to be enhanced so that fewer users will try it.
Otherwise, we can leave that in now, may be even make asan enabled if the compiler supports it, and decide before releasing jumbo1 whether we just change the default to disabled or remove the feature for the release.
@frank-dittrich commented on GitHub (Dec 17, 2014):
With asan enabled, I get
@frank-dittrich commented on GitHub (Dec 17, 2014):
And running --test=0:
@jfoug commented on GitHub (Dec 17, 2014):
I get those bugs also Frank.
It is frequently 1 byte before the 'tests' element of the format. I think there is some 'core' issue (probably with the cost code, or something with the tests), that is writing blindly to memory.
Some formats seem fine. Others fail. You can do -test=0 -form=format to test each one, and start to see the 'pattern'. THIS was why I was saying getting asan working at config time, is NOT a great idea, unless we can get it working cleanly.
@kholia commented on GitHub (Dec 17, 2014):
We will get it working cleanly. I have already started committing some patches to exclude "known-good" methods.
@jfoug commented on GitHub (Dec 17, 2014):
Here is an exmple showing 1 to the left of the first test string:
I know (hope) you are working on this @kholia The good thing about this, is that it gets some of these fixed NOW, things that actually may be BAD for us.
@kholia commented on GitHub (Dec 17, 2014):
Also, try
./unused/analisa_test_runner.sh. It's pretty awesome ;)@frank-dittrich commented on GitHub (Dec 17, 2014):
I think you didn't commit ./unused/analisa_test_runner.sh
@jfoug commented on GitHub (Dec 17, 2014):
I have it.
@frank-dittrich commented on GitHub (Dec 17, 2014):
OK, I just didn't fetch the latest commits.
BTW: If we just silence all asan warnings (and add // XXX comments), why do we need --enable-asan?
There are even some rather old ATTRIBUTE_NO_ADDRESS_SAFETY_ANALYSIS changes:
@frank-dittrich commented on GitHub (Dec 17, 2014):
how do I convert that stack into something readable:
Not even with a debug build it is showing source code lines...
@kholia commented on GitHub (Dec 17, 2014):
Use http://llvm.org/klaus/compiler-rt/raw/release_35/lib/asan/scripts/asan_symbolize.py
@frank-dittrich commented on GitHub (Dec 17, 2014):
Thanks. You should add this information and other useful tips to
doc/AddressSanitizer-HOWTO.txt, after a big warning that using --enable-asan really is just for developers.@kholia commented on GitHub (Dec 17, 2014):
Let's get the fixes in first and stop worrying about nosey (but simultaneously dumb) users.
@frank-dittrich commented on GitHub (Dec 17, 2014):
OK, pasting that stack into that tool gives:
formats.c:405
This is a real bug.
LM is not a salted format, so accessing salt)[format->params.salt_size-1] definitely is a bug that should be fixed in core as well.
@kholia commented on GitHub (Dec 17, 2014):
@frank-dittrich good catch 👍
Is this a reasonable patch?
@frank-dittrich commented on GitHub (Dec 17, 2014):
I already committed a patch, but than realized that Jims commit
4df19364e8aleady fixed it.So I have to revert my commit
ccad62ea6a.Next time I'll check whether my fix is still necessary before pushing the change...
@kholia commented on GitHub (Dec 17, 2014):
@frank-dittrich @jfoug Great work! 👍
ASan support is already paying itself off ;)
@jfoug commented on GitHub (Dec 17, 2014):
Can we put this python file into unused?
@frank-dittrich commented on GitHub (Dec 17, 2014):
Why would we need to ship it? Just download somewhere into your $PATH?
Otherwise, we'd need to read the license. And we'd get support requests for bugs which we would need to report upstream-
@kholia commented on GitHub (Dec 17, 2014):
Also, GCC 4.9.x does this decoding stuff automatically :-)
@jfoug commented on GitHub (Dec 17, 2014):
I think I have found a function which is giving false warnings. YES, we do read past the end of the buffer, and it gets caught. This is a common method @magnumripper has been doing. The file is:
hmacMD5_fmt_plug.c line 209. What we are doing is reading the password 1 32 bit value at a time.
@jfoug commented on GitHub (Dec 17, 2014):
@kholia is the only way to work around problems like I list above, by using the ATTRIBUTE_NO_ADDRESS_SAFETY_ANALYSIS attrib? I did that, and the warning went away. I also only use that attrib IF we are building in MMX_COEF mode.
I did comment that change, listing why it was done.
@kholia commented on GitHub (Dec 17, 2014):
@jfoug yes,
ATTRIBUTE_NO_ADDRESS_SAFETY_ANALYSIScan be used to mark such "known-good" functions. It is not ideal but a man's gotta do what a man's gotta do.@jfoug commented on GitHub (Dec 17, 2014):
It would be better to be able to mark the exact line, vs throwing away the whole function
I know exactly WHY magnum did what he did. It makes loading much faster. You do possibly read past end of buffer (by up to 3 bytes), but nothing is written, it cause no problems, this is only done on Intel systems, etc. Thus, the code is ugly, 'bad-practice', BUT is faster and works. I guess there 'could' be a problem, if the 3 bytes were on a memory page not loaded (such as mmap stuff, I guess). but we would have heard SOMETHING about this before now. This is done in many formats.
@jfoug commented on GitHub (Dec 17, 2014):
I am keeping this comment updated:
github.com/magnumripper/JohnTheRipper@4df19364e8as we work through these.@frank-dittrich commented on GitHub (Dec 17, 2014):
What if you make a new function out of the offending statement? May be a function that will be inlined anyway? Or some macro which converts the statement into a called function when built with asan support?
@jfoug commented on GitHub (Dec 17, 2014):
They are all a single deref of a uint32 pointer. That pointer was set to the original password. So what we are doing is accessing the password 4 bytes at a time, until we detect the end of the password. However, we have already READ the last bytes (might be 4 that are valid, might only be 1). That is what is tripping us up. There 'may' be a way to work around this, using #define magic. I will look at it when I get done. I will have a list of exactly which formats are doing this. I think I can do it, BUT it will give us 2 different build states. One will be with a tiny function, if ASAN is enabled, the other will be 'normal' build. I guess it will give us ASAN for everything other that that one instruction (which we KNOW we are handing properly), but still allowing ASAN for the entire rest of the set_key function.
@magnumripper commented on GitHub (Dec 17, 2014):
Please refrain from doing anything of the sort. Isn't it better to just live with the FPs and learn which to ignore?
BTW, is there no way to "teach" ASAN (eg. using a config file) about our specific FPs so it won't complain again? That would be a whole lot cleaner than polluting our code.
@jfoug commented on GitHub (Dec 17, 2014):
Agreed. What we are doing is normally a BAD THING. But we are doing it with (I hope) full knowledge. Yes if there is some way to tell it to ignore this certain pattern, that would be best. Or even some override like what we have for a function to instead turn it off for a statement
But right now, for CPU, I think we are good. I just ran a full -test=0 -form=cpu and it completed.
I can not test GPU. I run my Ubuntu out of a VM, and can not access GPU from there. Cygwin can compile with ASAN, but does not have -lasan so building is SOL.
@frank-dittrich commented on GitHub (Dec 18, 2014):
Either doc/AddressSanitizer-HOWTO.txt or ./config --help still needs to be enhanced to stop regular users from enabling this "feature".
@frank-dittrich commented on GitHub (Dec 18, 2014):
This will currently happen for functions that the compiler would otherwise inline, see the macro definition:
@jfoug commented on GitHub (Dec 18, 2014):
What should the ./configure --help say? Currently, it says this:
Build with AddressSanitizer@frank-dittrich commented on GitHub (Dec 18, 2014):
On 12/18/2014 10:02 AM, JimF wrote:
Just say that it is ony needed for developers and it will make john run
slower. That should prevent most regular users from enabling it.
@jfoug commented on GitHub (Dec 18, 2014):
Same goes for other debugging stuff. Memdbg is also in this class. It does less than addr sanitizer, but does some things better, and has a much smaller runtime footprint. But it does slow down jtr. The extended version slows down jtr A LOT, since it does not free memory (right away), and the memory walk can be time consuming.
I am looking at simply removing the configure help 'listing' this (pretty easy, but leaves a blank line). Is this something that would be acceptable? This addition really SHOULD NOT be used by a non-developer/tester who is in the know for why/how it is.
@frank-dittrich commented on GitHub (Dec 18, 2014):
But just removing the info from --help output would also hide the information from users who do know how to use it and who could save us effort by providing better bug reports or fixes.
I think the warning that it is only for developers and make john run slower is good enough. May be add the same warning to other debug options.
@jfoug commented on GitHub (Dec 18, 2014):
I am going to try to do this in one 'swoop'. I am going to try to add a '*' to each line and then show the * on address sanitizer (on the next line), so that I can make 1 comment about these are for development/QA work, and will cause runtime performance impacts.
@frank-dittrich commented on GitHub (Dec 18, 2014):
I see the summary already has
Should
these hurt performancebe changed tothese hurt performance when enabledorenabling these hurts performance?@jfoug commented on GitHub (Dec 18, 2014):
How about verbiage like this (I just read your message above also, that is another area we can improve)
@jfoug commented on GitHub (Dec 18, 2014):
and I might remove the '*' from --enable-memdbg It really is pretty safe AND useful. If anything, it would generate 'good' information from users that user parts of the code in ways that developers do not (i.e. finding un-exercised bugs)
@jfoug commented on GitHub (Dec 18, 2014):
I would think
these hurt performance when enabledwould be good wording. That is has better meaning (to me) whether they are either current enabled or disabled.@jfoug commented on GitHub (Dec 18, 2014):
I wonder if
Debug options (these hurt performance when enabled)would be better asDeveloper options (these hurt performance when enabled)?@jfoug commented on GitHub (Dec 18, 2014):
@frank-dittrich
Please validate
4314fb5@magnumripper commented on GitHub (Dec 18, 2014):
I think we can close this. Any future issue should become a new Git issue.