mirror of
https://github.com/openwall/john.git
synced 2026-12-03 18:45:21 +07:00
[GH-ISSUE #2908] Enable alignment checking within UBSan #1838
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#1838
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 20, 2017).
Original GitHub issue: https://github.com/openwall/john/issues/2908
Currently when UBSan is enabled, the alignment sanitizer is disabled. This can be re-enabled.
To do this, we need to change the configure.ac to NOT do -fno-address-sanatizer
Then we add -DARCH_ALLOWS_UNALIGNED=0 to the 'extra CFLAGS (similar to how we add -DWITH_UBSAN to the compile line)
Then change all arch.h file which have ARCH_ALLOWS_UNALIGNED 1 to be this:
#if !defined (ARCH_ALLOWS_UNALIGNED)
#define ARCH_ALLOWS_UNALIGNED 1
#endif
That way, the compiler call will set a forced alignment requirement, and the arch.h will not mess with it.
Bug #2868
@jfoug commented on GitHub (Nov 22, 2017):
I tried to simply add the -faddress-sanatizer to the existing configure script. All sorts of runtime problems. But I can run the -faddress-sanitizer all by itself (removing the other UBSan items). I do not have enough knowledge of what was talked about getting the current UBSan params setup. So for now, we have a 'special' hacking way to setup an environment to work with address-sanitizer enabled (but no other UBSan stuff). It will certainly allow us to get john alignment fixed.
BUT we need some way to add this easily, so that once we get john alignment happy that it stays that way.
@jfoug commented on GitHub (Nov 29, 2017):
NOTE, added a new --enable-ubsanalign The existing --enable-ubsan still does not include alignment tests. --enable-ubsanalign does NOT contain the other ubsan tests. When I tried to add things to the existing ubsan testing, I could not get it working right, so I simply added a new enable.
This --enable-ubsanalign is being used in bug #2868
@jfoug commented on GitHub (Dec 3, 2017):
I believe I can get this all working under --with-ubsan, and get the entire
-fsanitize=undefinedlogic working properly, on a single target.I had to make a tweek to a few format files (the
#pragma omp parallel forhad to be reduced to the vanilla version (removing the extra params). This worked fine on 2 formats, but on the 3rd (only 3 had this problem), I was getting builds to work, but testing was failing. this format (mscash2) I will simply neuter GOMP when I see builds happening WITH_UBSAN set. Not ideal, if there was some undefined behavior happening only in the OMP code, but it is the best I have been able to do so far.@jfoug commented on GitHub (Dec 3, 2017):
790768289This adds full UBSan to a single target.NOTE, it already has found an undefined item (memcpy(a,b,c) where a was passed a null) just in the testing ;)
This task is now fully completed, and down to a clean single configure enable. NOTE, fully UBSan is pretty damn slow, but that is OK. The branch I had only testing alignment was pretty much same speed as a normal build, but full UBSAN is very noticeably slower.
I did test out that the ubsan stuff was working, by making a change to sapG format (for testing). I set ARCH_ALLOWS_UNALIGNED back to 1, rebuilt, and got several UBSan failures in that format. So things look very good.
Build is error/warning free (had to fix 3 formats to get this), and a --test-full=0 is also UBSan warning free (well, it will be when I get that bug from formats.c fixed).
Closing this issue, it is done!