mirror of
https://github.com/openwall/john.git
synced 2026-12-03 18:45:21 +07:00
[GH-ISSUE #1195] memdbg should never return memory aligned better than requested #749
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#749
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 @magnumripper on GitHub (Apr 9, 2015).
Original GitHub issue: https://github.com/openwall/john/issues/1195
Maybe this is already implemented? If not, it's probably a good idea for catching bugs.
@magnumripper commented on GitHub (Apr 12, 2015):
Blocked by #1200
@magnumripper commented on GitHub (May 22, 2015):
This is
no longer completelystill blocked by #1200. But anyway, we can implement this in mem_alloc_tiny() right away.So how do we go about doing it? For mem_alloc_tiny() it should be easy:
size += align.I need to think this over. Is it this simple? I think it is.
@magnumripper commented on GitHub (May 22, 2015):
Done! Works like a champ. Probably very wasteful but who cares, it's debug code!
@magnumripper commented on GitHub (May 22, 2015):
Not sure if we can do this at all in memdbg, without completely changing how it does things. OTOH that will be needed for #1200 anyway.
@magnumripper commented on GitHub (May 22, 2015):
Not a single salt/binary align bug found. We must have fixed the last one JUST before implementing this! Like in
c98950f9or something. Doh! But we'll find them easily in the future.@jfoug commented on GitHub (May 22, 2015):
I am planning on revamp of memdbg. I will do this with 2 headers. The first header will have a magic value, a pointer to the 2Nd header, and a fence post. The fence post will butt up to the start of the memory. There will be at least 4 bytes of fence post, possibly more. The pointer will be 16 byte aligned. And at least 4 bytes preceeding the memory buffer. Computing the location of this pointer can be done only knowing the iser memory ponter. Just before this pointer is anouther magic value that will validate the pointer as not being overwritten. There will likely be memory allocated in front of this header. That memory is unused. Trailing the user memory will be a fence post. Following the fence post, on an even 16 byte offset will be header 2. This header will be similar to the current first header, but it will also have a pointer to the actual allocated buffer, ie, somewhere in front of the first header.
Simple stuff, but may take a bit of debugging to get everything working right. But with this new design, we can get the user memory to start at any offset, since the first header is no longer fixed size
@frank-dittrich commented on GitHub (May 23, 2015):
On 05/22/2015 10:06 PM, magnum wrote:
Did you test on non-x86?
@magnumripper commented on GitHub (May 23, 2015):
No, but few formats differ in binary/salt.
@jfoug commented on GitHub (May 27, 2015):
This should be fixed (I think) in
20ce8feThere is a #define in john.c (at the very start of main) that should test memdbg. It simple tests all alignments from 1 to 256. It checks that the alignment is correct. It also tests that the pointer/align is not %=0 to the alignment. The only one that 'is' %=0 to alignment is alignment 1.
After this change, I see no salt() misalignments. They should show up now.
@magnumripper commented on GitHub (May 27, 2015):
Cool. These things will make our annual Sparc sessions much shorter :)
@jfoug commented on GitHub (May 27, 2015):
The biggest thing is where there is insufficient salt/binary alignment. Say it is 1, but needs to be sizeof(int) or something.
On -test=0, xsha512 is now failing. Pomelo still fails, but there was never an attempt to get it working.
@jfoug commented on GitHub (May 28, 2015):
I found a core in hmacSHA384. It was allocations of the ipad/opad ctx vars. We were aligning to ARCH_WORD, but on 32 bit systems, that is only 4 bytes (8 bytes is the size of the 64 bit data). This did not show up on -test=0, but was found with the TS. Simple fix. I just allocate to forced align of 8.
But getting allocation to align to force a maximal alignment to be the same as minimal should flush out problems easier, or at least trigger warnings that force us to figure things out.
NOTE, the *_tiny() allocations do not have this max alignment=min alignment, but I think you dropped most of those and switch to mem_alloc_align
@magnumripper commented on GitHub (May 28, 2015):
Tiny has it since
093d04b