[GH-ISSUE #1392] malloc.c: Assertion failed [1] #885

Closed
opened 2026-10-14 03:27:03 +07:00 by bsakaguchi · 2 comments
Owner

Originally created by @loverszhaokai on GitHub (Jun 7, 2015).
Original GitHub issue: https://github.com/openwall/john/issues/1392

This bug is found by afl.
#1. Reproduce

$ ./configure && make -sj8
$ cat pwfile

{ssha1}06$T6numGi8BRLzTYnF$AdXq1t6baevg9/cu5QBBk8Xg.se
{ssha1}06$6cZ2YrFYwVQPAVNb$1agAljwERjlin9RxFxzKl.E0.sJ
{ssha1}06$uOYCzfO5dt0EdnwG$CK81ljQknzEAcfwg97cocEwz.gv
{ssha256}06$YPhynOx/iJQaJOeV$EXQbOSYZftEo3k01uoanAbA7jEKZRUU9LCCs/tyU.wG
{ssha256}06$5lsi4pETf/0p/12k$xACBftDMh30RqgrM5Sppl.Txgho41u0oPoD21E1b.QT
{ssha256}06$qcXPTOQzDAqZuiHc$pS/1HC4uI5jIERNerX8.Zd0G/gDepZuqR7S5WHEn.AW
{ssha512}06$y2/.O4drNJd3ecgJ$DhNk3sS28lkIo7XZaXWSkFOIdP2Zmd9DIKdYdSuSU5tsnl29Q7xTc3f64eAGMpcMJCVp/SXZ4Xgx3jlHVIOr..
{ssha512}06$Dz/dDr1qa8JJm0UB$DFNu2�US18fW37ht8WRiwhSeOqAMJTJ6mLDW03D/SeQpdI50GJMYb1fBog5/ZU3oM9qsSr9w6u22.OjjufV..
{ssha512}06$................$0egLaF88SUk6GAFIMN/vTwa/IYB.KlubYmQftS8qs7ULLQpRLrA3LA....
{ssha512}06$aXayEJGxA02Bl4d2$TWfWx34oD.UjrS/Qtco6Ij2XPY1CPYJfdk3CcxEjnMZvQw2p5obHYH7SI2wxcJgaS9.S9Hz948R.GdGwsvR...
{ssha512}06$otYx2eSXx.OkEY4F$No5ZvSfhYuB1MSkBhhcKJIjS0.q//awdkcZw����Xi3EnL6QeronmS0jCc3P2aEV9WLi5arzN1:jVwkx8bng..
{ssha512}06$w6THk2lJbkqW0rXv$yH6VWp3X9ad2l8nhYi22lrrmWskXvEU.PONbWUAZHrjhgQjdU83jtRnYmpRZIJVQPAVNb$1agAljwERjlin9..

$ ./john pwfile

Warning: only loading hashes of type "aix-ssha1", but also saw type "aix-ssha256"
Use the "--format=aix-ssha256" option to force loading hashes of that type instead
Warning: only loading hashes of type "aix-ssha1", but also saw type "aix-ssha512"
Use the "--format=aix-ssha512" option to force loading hashes of that type instead
Warning: invalid UTF-8 seen reading out/crashes/id:000000,sig:06,src:000005,op:havoc,rep:8
Using default input encoding: UTF-8
Loaded 3 password hashes with 3 different salts (aix-ssha1, AIX LPA {ssha1} [PBKDF2-SHA1 256/256 AVX2 8x])
Will run 8 OpenMP threads
john: malloc.c:2372: sysmalloc: Assertion `(old_top == (((mbinptr) (((char *) &((av)->bins[((1) - 1) * 2])) - __builtin_offsetof (struct malloc_chunk, fd)))) && old_size == 0) || ((unsigned long) (old_size) >= (unsigned long)((((__builtin_offsetof (struct malloc_chunk, fd_nextsize))+((2 *(sizeof(size_t))) - 1)) & ~((2 *(sizeof(size_t))) - 1))) && ((old_top)->size & 0x1) && ((unsigned long) old_end & pagemask) == 0)' failed.
Aborted

#2. GDB debug

john: malloc.c:2372: sysmalloc: Assertion `(old_top == (((mbinptr) (((char *) &((av)->bins[((1) - 1) * 2])) - __builtin_offsetof (struct malloc_chunk, fd)))) && old_size == 0) || ((unsigned long) (old_size) >= (unsigned long)((((__builtin_offsetof (struct malloc_chunk, fd_nextsize))+((2 *(sizeof(size_t))) - 1)) & ~((2 *(sizeof(size_t))) - 1))) && ((old_top)->size & 0x1) && ((unsigned long) old_end & pagemask) == 0)' failed.

Program received signal SIGABRT, Aborted.
0x00007ffff6668cc9 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
56  ../nptl/sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
#0  0x00007ffff6668cc9 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
#1  0x00007ffff666c0d8 in __GI_abort () at abort.c:89
#2  0x00007ffff66af7fd in __malloc_assert (
    assertion=assertion@entry=0x7ffff67b4060 "(old_top == (((mbinptr) (((char *) &((av)->bins[((1) - 1) * 2])) - __builtin_offsetof (struct malloc_chunk, fd)))) && old_size == 0) || ((unsigned long) (old_size) >= (unsigned long)((((__builtin_offs"..., file=file@entry=0x7ffff67afb80 "malloc.c", line=line@entry=2372,
    function=function@entry=0x7ffff67afefe <__func__.11292> "sysmalloc") at malloc.c:293
#3  0x00007ffff66b2c68 in sysmalloc (av=0x7ffff69f0760 <main_arena>, nb=229392) at malloc.c:2369
#4  _int_malloc (av=0x7ffff69f0760 <main_arena>, bytes=229376) at malloc.c:3800
#5  0x00007ffff66b47b0 in __GI___libc_malloc (bytes=229376) at malloc.c:2891
#6  0x00000000005d825e in mem_alloc_func (size=size@entry=229376) at memory.c:89
#7  0x00000000005cf8d8 in log_file_init (f=f@entry=0x972c60 <pot>, name=name@entry=0x11c32a1 "$JOHN/john.pot", size=32768) at logger.c:101
#8  0x00000000005cf9f5 in log_init (log_name=<optimized out>, pot_name=0x11c32a1 "$JOHN/john.pot", session=<optimized out>) at logger.c:269
#9  0x00000000005cab46 in john_run () at john.c:1382
#10 0x00000000005cb52f in main (argc=2, argv=0x7fffffffe978) at john.c:1743
Originally created by @loverszhaokai on GitHub (Jun 7, 2015). Original GitHub issue: https://github.com/openwall/john/issues/1392 This bug is found by afl. #1. Reproduce $ ./configure && make -sj8 $ cat pwfile ``` {ssha1}06$T6numGi8BRLzTYnF$AdXq1t6baevg9/cu5QBBk8Xg.se {ssha1}06$6cZ2YrFYwVQPAVNb$1agAljwERjlin9RxFxzKl.E0.sJ {ssha1}06$uOYCzfO5dt0EdnwG$CK81ljQknzEAcfwg97cocEwz.gv {ssha256}06$YPhynOx/iJQaJOeV$EXQbOSYZftEo3k01uoanAbA7jEKZRUU9LCCs/tyU.wG {ssha256}06$5lsi4pETf/0p/12k$xACBftDMh30RqgrM5Sppl.Txgho41u0oPoD21E1b.QT {ssha256}06$qcXPTOQzDAqZuiHc$pS/1HC4uI5jIERNerX8.Zd0G/gDepZuqR7S5WHEn.AW {ssha512}06$y2/.O4drNJd3ecgJ$DhNk3sS28lkIo7XZaXWSkFOIdP2Zmd9DIKdYdSuSU5tsnl29Q7xTc3f64eAGMpcMJCVp/SXZ4Xgx3jlHVIOr.. {ssha512}06$Dz/dDr1qa8JJm0UB$DFNu2�US18fW37ht8WRiwhSeOqAMJTJ6mLDW03D/SeQpdI50GJMYb1fBog5/ZU3oM9qsSr9w6u22.OjjufV.. {ssha512}06$................$0egLaF88SUk6GAFIMN/vTwa/IYB.KlubYmQftS8qs7ULLQpRLrA3LA.... {ssha512}06$aXayEJGxA02Bl4d2$TWfWx34oD.UjrS/Qtco6Ij2XPY1CPYJfdk3CcxEjnMZvQw2p5obHYH7SI2wxcJgaS9.S9Hz948R.GdGwsvR... {ssha512}06$otYx2eSXx.OkEY4F$No5ZvSfhYuB1MSkBhhcKJIjS0.q//awdkcZw����Xi3EnL6QeronmS0jCc3P2aEV9WLi5arzN1:jVwkx8bng.. {ssha512}06$w6THk2lJbkqW0rXv$yH6VWp3X9ad2l8nhYi22lrrmWskXvEU.PONbWUAZHrjhgQjdU83jtRnYmpRZIJVQPAVNb$1agAljwERjlin9.. ``` $ ./john pwfile ``` C Warning: only loading hashes of type "aix-ssha1", but also saw type "aix-ssha256" Use the "--format=aix-ssha256" option to force loading hashes of that type instead Warning: only loading hashes of type "aix-ssha1", but also saw type "aix-ssha512" Use the "--format=aix-ssha512" option to force loading hashes of that type instead Warning: invalid UTF-8 seen reading out/crashes/id:000000,sig:06,src:000005,op:havoc,rep:8 Using default input encoding: UTF-8 Loaded 3 password hashes with 3 different salts (aix-ssha1, AIX LPA {ssha1} [PBKDF2-SHA1 256/256 AVX2 8x]) Will run 8 OpenMP threads john: malloc.c:2372: sysmalloc: Assertion `(old_top == (((mbinptr) (((char *) &((av)->bins[((1) - 1) * 2])) - __builtin_offsetof (struct malloc_chunk, fd)))) && old_size == 0) || ((unsigned long) (old_size) >= (unsigned long)((((__builtin_offsetof (struct malloc_chunk, fd_nextsize))+((2 *(sizeof(size_t))) - 1)) & ~((2 *(sizeof(size_t))) - 1))) && ((old_top)->size & 0x1) && ((unsigned long) old_end & pagemask) == 0)' failed. Aborted ``` #2. GDB debug ``` C john: malloc.c:2372: sysmalloc: Assertion `(old_top == (((mbinptr) (((char *) &((av)->bins[((1) - 1) * 2])) - __builtin_offsetof (struct malloc_chunk, fd)))) && old_size == 0) || ((unsigned long) (old_size) >= (unsigned long)((((__builtin_offsetof (struct malloc_chunk, fd_nextsize))+((2 *(sizeof(size_t))) - 1)) & ~((2 *(sizeof(size_t))) - 1))) && ((old_top)->size & 0x1) && ((unsigned long) old_end & pagemask) == 0)' failed. Program received signal SIGABRT, Aborted. 0x00007ffff6668cc9 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56 56 ../nptl/sysdeps/unix/sysv/linux/raise.c: No such file or directory. (gdb) bt #0 0x00007ffff6668cc9 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56 #1 0x00007ffff666c0d8 in __GI_abort () at abort.c:89 #2 0x00007ffff66af7fd in __malloc_assert ( assertion=assertion@entry=0x7ffff67b4060 "(old_top == (((mbinptr) (((char *) &((av)->bins[((1) - 1) * 2])) - __builtin_offsetof (struct malloc_chunk, fd)))) && old_size == 0) || ((unsigned long) (old_size) >= (unsigned long)((((__builtin_offs"..., file=file@entry=0x7ffff67afb80 "malloc.c", line=line@entry=2372, function=function@entry=0x7ffff67afefe <__func__.11292> "sysmalloc") at malloc.c:293 #3 0x00007ffff66b2c68 in sysmalloc (av=0x7ffff69f0760 <main_arena>, nb=229392) at malloc.c:2369 #4 _int_malloc (av=0x7ffff69f0760 <main_arena>, bytes=229376) at malloc.c:3800 #5 0x00007ffff66b47b0 in __GI___libc_malloc (bytes=229376) at malloc.c:2891 #6 0x00000000005d825e in mem_alloc_func (size=size@entry=229376) at memory.c:89 #7 0x00000000005cf8d8 in log_file_init (f=f@entry=0x972c60 <pot>, name=name@entry=0x11c32a1 "$JOHN/john.pot", size=32768) at logger.c:101 #8 0x00000000005cf9f5 in log_init (log_name=<optimized out>, pot_name=0x11c32a1 "$JOHN/john.pot", session=<optimized out>) at logger.c:269 #9 0x00000000005cab46 in john_run () at john.c:1382 #10 0x00000000005cb52f in main (argc=2, argv=0x7fffffffe978) at john.c:1743 ```
Author
Owner

@jfoug commented on GitHub (Jun 23, 2015):

@loverszhaokai Please retest after e899fa7

<!-- gh-comment-id:114535185 --> @jfoug commented on GitHub (Jun 23, 2015): @loverszhaokai Please retest after e899fa7
Author
Owner

@loverszhaokai commented on GitHub (Jun 24, 2015):

@jfoug Fixed. Thanks.

<!-- gh-comment-id:114685707 --> @loverszhaokai commented on GitHub (Jun 24, 2015): @jfoug Fixed. Thanks.
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#885
No description provided.