Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

aa crash #3021

Closed
zonkzonk opened this issue Jul 30, 2015 · 36 comments
Closed

aa crash #3021

zonkzonk opened this issue Jul 30, 2015 · 36 comments

Comments

@zonkzonk
Copy link
Contributor

morn,

aa crash on ROPGadget testsuite bin:

r2 -a arm  ./Downloads/src/ROPgadget/test-suite-binaries/elf-ARM64-bash 
Unsupported relocs for this arch
Unsupported relocs for this arch
Unsupported relocs for this arch
Unsupported relocs for this arch
 -- Remember that word: C H A I R
[0x0041e768]> aa
Segmentation fault (core dumped)
dmesg|tail -1
[26167.948383] r2[24424]: segfault at ffffffff ip b66423b7 sp bfd39c4c 
error 5 in libc-2.13.so[b6601000+15e000]

Greetings
--zlul

valgrind follows:

http://sprunge.us/CIbi

==26833== Memcheck, a memory error detector
==26833== Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et al.
==26833== Using Valgrind-3.7.0 and LibVEX; rerun with -h for copyright info
==26833== Command: /usr/bin/r2 -c aa Downloads/src/ROPgadget/test-suite-binaries/elf-ARM64-bash
==26833== Parent PID: 829
==26833== 
==26833== Conditional jump or move depends on uninitialised value(s)
==26833==    at 0x504CE29: vfprintf (vfprintf.c:1628)
==26833==    by 0x506ED7F: vsnprintf (vsnprintf.c:120)
==26833==    by 0x4FD100B: r_strbuf_setf (strbuf.c:47)
==26833==    by 0x42B3782: analop64_esil (anal_arm_cs.c:168)
==26833==    by 0x42B6205: analop (anal_arm_cs.c:745)
==26833==    by 0x4304BB0: r_anal_op (op.c:54)
==26833==    by 0x4306EA9: fcn_recurse (fcn.c:292)
==26833==    by 0x4308511: fcn_recurse (fcn.c:560)
==26833==    by 0x4308511: fcn_recurse (fcn.c:560)
==26833==    by 0x4308511: fcn_recurse (fcn.c:560)
==26833==    by 0x4308511: fcn_recurse (fcn.c:560)
==26833==    by 0x4308AD1: r_anal_fcn (fcn.c:642)
==26833== 
==26833== Conditional jump or move depends on uninitialised value(s)
==26833==    at 0x5048E64: _itoa (_itoa.c:309)
==26833==    by 0x504BC79: vfprintf (vfprintf.c:1628)
==26833==    by 0x506ED7F: vsnprintf (vsnprintf.c:120)
==26833==    by 0x4FD100B: r_strbuf_setf (strbuf.c:47)
==26833==    by 0x42B3782: analop64_esil (anal_arm_cs.c:168)
==26833==    by 0x42B6205: analop (anal_arm_cs.c:745)
==26833==    by 0x4304BB0: r_anal_op (op.c:54)
==26833==    by 0x4306EA9: fcn_recurse (fcn.c:292)
==26833==    by 0x4308511: fcn_recurse (fcn.c:560)
==26833==    by 0x4308511: fcn_recurse (fcn.c:560)
==26833==    by 0x4308511: fcn_recurse (fcn.c:560)
==26833==    by 0x4308511: fcn_recurse (fcn.c:560)
==26833== 
==26833== Conditional jump or move depends on uninitialised value(s)
==26833==    at 0x5048E72: _itoa (_itoa.c:316)
==26833==    by 0x504BC79: vfprintf (vfprintf.c:1628)
==26833==    by 0x506ED7F: vsnprintf (vsnprintf.c:120)
==26833==    by 0x4FD100B: r_strbuf_setf (strbuf.c:47)
==26833==    by 0x42B3782: analop64_esil (anal_arm_cs.c:168)
==26833==    by 0x42B6205: analop (anal_arm_cs.c:745)
==26833==    by 0x4304BB0: r_anal_op (op.c:54)
==26833==    by 0x4306EA9: fcn_recurse (fcn.c:292)
==26833==    by 0x4308511: fcn_recurse (fcn.c:560)
==26833==    by 0x4308511: fcn_recurse (fcn.c:560)
==26833==    by 0x4308511: fcn_recurse (fcn.c:560)
==26833==    by 0x4308511: fcn_recurse (fcn.c:560)
==26833== 
==26833== Conditional jump or move depends on uninitialised value(s)
==26833==    at 0x5048EB3: _itoa (_itoa.c:442)
==26833==    by 0x504BC79: vfprintf (vfprintf.c:1628)
==26833==    by 0x506ED7F: vsnprintf (vsnprintf.c:120)
==26833==    by 0x4FD100B: r_strbuf_setf (strbuf.c:47)
==26833==    by 0x42B3782: analop64_esil (anal_arm_cs.c:168)
==26833==    by 0x42B6205: analop (anal_arm_cs.c:745)
==26833==    by 0x4304BB0: r_anal_op (op.c:54)
==26833==    by 0x4306EA9: fcn_recurse (fcn.c:292)
==26833==    by 0x4308511: fcn_recurse (fcn.c:560)
==26833==    by 0x4308511: fcn_recurse (fcn.c:560)
==26833==    by 0x4308511: fcn_recurse (fcn.c:560)
==26833==    by 0x4308511: fcn_recurse (fcn.c:560)
==26833== 
==26833== Use of uninitialised value of size 4
==26833==    at 0x5048EC3: _itoa (_itoa.c:448)
==26833==    by 0x504BC79: vfprintf (vfprintf.c:1628)
==26833==    by 0x506ED7F: vsnprintf (vsnprintf.c:120)
==26833==    by 0x4FD100B: r_strbuf_setf (strbuf.c:47)
==26833==    by 0x42B3782: analop64_esil (anal_arm_cs.c:168)
==26833==    by 0x42B6205: analop (anal_arm_cs.c:745)
==26833==    by 0x4304BB0: r_anal_op (op.c:54)
==26833==    by 0x4306EA9: fcn_recurse (fcn.c:292)
==26833==    by 0x4308511: fcn_recurse (fcn.c:560)
==26833==    by 0x4308511: fcn_recurse (fcn.c:560)
==26833==    by 0x4308511: fcn_recurse (fcn.c:560)
==26833==    by 0x4308511: fcn_recurse (fcn.c:560)
==26833== 
==26833== Conditional jump or move depends on uninitialised value(s)
==26833==    at 0x5048ECB: _itoa (_itoa.c:442)
==26833==    by 0x504BC79: vfprintf (vfprintf.c:1628)
==26833==    by 0x506ED7F: vsnprintf (vsnprintf.c:120)
==26833==    by 0x4FD100B: r_strbuf_setf (strbuf.c:47)
==26833==    by 0x42B3782: analop64_esil (anal_arm_cs.c:168)
==26833==    by 0x42B6205: analop (anal_arm_cs.c:745)
==26833==    by 0x4304BB0: r_anal_op (op.c:54)
==26833==    by 0x4306EA9: fcn_recurse (fcn.c:292)
==26833==    by 0x4308511: fcn_recurse (fcn.c:560)
==26833==    by 0x4308511: fcn_recurse (fcn.c:560)
==26833==    by 0x4308511: fcn_recurse (fcn.c:560)
==26833==    by 0x4308511: fcn_recurse (fcn.c:560)
==26833== 
==26833== Conditional jump or move depends on uninitialised value(s)
==26833==    at 0x504B78B: vfprintf (vfprintf.c:1628)
==26833==    by 0x506ED7F: vsnprintf (vsnprintf.c:120)
==26833==    by 0x4FD100B: r_strbuf_setf (strbuf.c:47)
==26833==    by 0x42B3782: analop64_esil (anal_arm_cs.c:168)
==26833==    by 0x42B6205: analop (anal_arm_cs.c:745)
==26833==    by 0x4304BB0: r_anal_op (op.c:54)
==26833==    by 0x4306EA9: fcn_recurse (fcn.c:292)
==26833==    by 0x4308511: fcn_recurse (fcn.c:560)
==26833==    by 0x4308511: fcn_recurse (fcn.c:560)
==26833==    by 0x4308511: fcn_recurse (fcn.c:560)
==26833==    by 0x4308511: fcn_recurse (fcn.c:560)
==26833==    by 0x4308AD1: r_anal_fcn (fcn.c:642)
==26833== 
==26833== Conditional jump or move depends on uninitialised value(s)
==26833==    at 0x504B7AD: vfprintf (vfprintf.c:1628)
==26833==    by 0x506ED7F: vsnprintf (vsnprintf.c:120)
==26833==    by 0x4FD100B: r_strbuf_setf (strbuf.c:47)
==26833==    by 0x42B3782: analop64_esil (anal_arm_cs.c:168)
==26833==    by 0x42B6205: analop (anal_arm_cs.c:745)
==26833==    by 0x4304BB0: r_anal_op (op.c:54)
==26833==    by 0x4306EA9: fcn_recurse (fcn.c:292)
==26833==    by 0x4308511: fcn_recurse (fcn.c:560)
==26833==    by 0x4308511: fcn_recurse (fcn.c:560)
==26833==    by 0x4308511: fcn_recurse (fcn.c:560)
==26833==    by 0x4308511: fcn_recurse (fcn.c:560)
==26833==    by 0x4308AD1: r_anal_fcn (fcn.c:642)
==26833== 
==26833== Conditional jump or move depends on uninitialised value(s)
==26833==    at 0x504CE29: vfprintf (vfprintf.c:1628)
==26833==    by 0x506ED7F: vsnprintf (vsnprintf.c:120)
==26833==    by 0x4FD100B: r_strbuf_setf (strbuf.c:47)
==26833==    by 0x42B370D: analop64_esil (anal_arm_cs.c:163)
==26833==    by 0x42B6205: analop (anal_arm_cs.c:745)
==26833==    by 0x4304BB0: r_anal_op (op.c:54)
==26833==    by 0x4306EA9: fcn_recurse (fcn.c:292)
==26833==    by 0x4308511: fcn_recurse (fcn.c:560)
==26833==    by 0x4308511: fcn_recurse (fcn.c:560)
==26833==    by 0x4308511: fcn_recurse (fcn.c:560)
==26833==    by 0x4308511: fcn_recurse (fcn.c:560)
==26833==    by 0x4308595: fcn_recurse (fcn.c:561)
==26833== 
==26833== Conditional jump or move depends on uninitialised value(s)
==26833==    at 0x504B78B: vfprintf (vfprintf.c:1628)
==26833==    by 0x506ED7F: vsnprintf (vsnprintf.c:120)
==26833==    by 0x4FD100B: r_strbuf_setf (strbuf.c:47)
==26833==    by 0x42B370D: analop64_esil (anal_arm_cs.c:163)
==26833==    by 0x42B6205: analop (anal_arm_cs.c:745)
==26833==    by 0x4304BB0: r_anal_op (op.c:54)
==26833==    by 0x4306EA9: fcn_recurse (fcn.c:292)
==26833==    by 0x4308511: fcn_recurse (fcn.c:560)
==26833==    by 0x4308511: fcn_recurse (fcn.c:560)
==26833==    by 0x4308511: fcn_recurse (fcn.c:560)
==26833==    by 0x4308511: fcn_recurse (fcn.c:560)
==26833==    by 0x4308595: fcn_recurse (fcn.c:561)
==26833== 
==26833== Conditional jump or move depends on uninitialised value(s)
==26833==    at 0x504B7AD: vfprintf (vfprintf.c:1628)
==26833==    by 0x506ED7F: vsnprintf (vsnprintf.c:120)
==26833==    by 0x4FD100B: r_strbuf_setf (strbuf.c:47)
==26833==    by 0x42B370D: analop64_esil (anal_arm_cs.c:163)
==26833==    by 0x42B6205: analop (anal_arm_cs.c:745)
==26833==    by 0x4304BB0: r_anal_op (op.c:54)
==26833==    by 0x4306EA9: fcn_recurse (fcn.c:292)
==26833==    by 0x4308511: fcn_recurse (fcn.c:560)
==26833==    by 0x4308511: fcn_recurse (fcn.c:560)
==26833==    by 0x4308511: fcn_recurse (fcn.c:560)
==26833==    by 0x4308511: fcn_recurse (fcn.c:560)
==26833==    by 0x4308595: fcn_recurse (fcn.c:561)
==26833== 
==26833== Invalid read of size 1
==26833==    at 0x504B3B7: vfprintf (vfprintf.c:1629)
==26833==    by 0x506ED7F: vsnprintf (vsnprintf.c:120)
==26833==    by 0x4FD100B: r_strbuf_setf (strbuf.c:47)
==26833==    by 0x42B2CDE: arm64math (anal_arm_cs.c:77)
==26833==    by 0x42B3292: analop64_esil (anal_arm_cs.c:111)
==26833==    by 0x42B6205: analop (anal_arm_cs.c:745)
==26833==    by 0x4304BB0: r_anal_op (op.c:54)
==26833==    by 0x4306EA9: fcn_recurse (fcn.c:292)
==26833==    by 0x4308511: fcn_recurse (fcn.c:560)
==26833==    by 0x4308511: fcn_recurse (fcn.c:560)
==26833==    by 0x4308511: fcn_recurse (fcn.c:560)
==26833==    by 0x4307BD0: fcn_recurse (fcn.c:464)
==26833==  Address 0xffffffff is not stack'd, malloc'd or (recently) free'd
==26833== 
==26833== 
==26833== Process terminating with default action of signal 11 (SIGSEGV)
==26833==  Access not within mapped region at address 0xFFFFFFFF
==26833==    at 0x504B3B7: vfprintf (vfprintf.c:1629)
==26833==    by 0x506ED7F: vsnprintf (vsnprintf.c:120)
==26833==    by 0x4FD100B: r_strbuf_setf (strbuf.c:47)
==26833==    by 0x42B2CDE: arm64math (anal_arm_cs.c:77)
==26833==    by 0x42B3292: analop64_esil (anal_arm_cs.c:111)
==26833==    by 0x42B6205: analop (anal_arm_cs.c:745)
==26833==    by 0x4304BB0: r_anal_op (op.c:54)
==26833==    by 0x4306EA9: fcn_recurse (fcn.c:292)
==26833==    by 0x4308511: fcn_recurse (fcn.c:560)
==26833==    by 0x4308511: fcn_recurse (fcn.c:560)
==26833==    by 0x4308511: fcn_recurse (fcn.c:560)
==26833==    by 0x4307BD0: fcn_recurse (fcn.c:464)
==26833==  If you believe this happened as a result of a stack
==26833==  overflow in your program's main thread (unlikely but
==26833==  possible), you can try to increase the size of the
==26833==  main thread stack using the --main-stacksize= flag.
==26833==  The main thread stack size used in this run was 8388608.
==26833== 
==26833== HEAP SUMMARY:
==26833==     in use at exit: 27,702,777 bytes in 47,706 blocks
==26833==   total heap usage: 95,601 allocs, 47,895 frees, 47,500,007 bytes allocated
==26833== 
==26833== LEAK SUMMARY:
==26833==    definitely lost: 20,892 bytes in 671 blocks
==26833==    indirectly lost: 19,841 bytes in 267 blocks
==26833==      possibly lost: 15,784 bytes in 46 blocks
==26833==    still reachable: 27,646,260 bytes in 46,722 blocks
==26833==         suppressed: 0 bytes in 0 blocks
==26833== Rerun with --leak-check=full to see details of leaked memory
==26833== 
==26833== For counts of detected and suppressed errors, rerun with: -v
==26833== Use --track-origins=yes to see where uninitialised values come from
==26833== ERROR SUMMARY: 1083 errors from 12 contexts (suppressed: 691 from 10)


radare2 0.10.0-git 8573 @ linux-little-x86-32 git.0.9.9-471-g9e42daf
commit: 9e42daf build: 2015-07-30

@zonkzonk
Copy link
Contributor Author

note, the updated valgrind log
still in
r2 -v
radare2 0.10.0-git 8582 @ linux-little-x86-32 git.0.9.9-480-g15e15e4
commit: 15e15e4 build: 2015-07-31

@alvarofe
Copy link
Contributor

I can't reproduce it in any OS (OpenBSD, Linux, Mac OS X) in all of them I get the following.

https://asciinema.org/a/5r62263p8mtsr2xan9t8ynhw7

@ret2libc
Copy link
Contributor

I can't reproduce on OS X. Have you tried to purge/clean the building directory/remove capstone/rebuild everything?

@zonkzonk
Copy link
Contributor Author

Hi, yes make purge, also it does not make sense to test on different OS. (me and you)
So, I used Debian 7.8 32bit and Archlinux 64bit with commit-id: 15e15e4

What are your test conditions?

@ret2libc
Copy link
Contributor

Have you also removed the capstone directory and rebuild everything? Anyway, I will download a debian 7.8 32 bit vagrant box and test on it.

@zonkzonk
Copy link
Contributor Author

yes, I did a fresh clone of the repo. Don't know about vagrant, but I tested on an Lenovo L540 :)

@zonkzonk
Copy link
Contributor Author

edit

@ret2libc see chat

@ret2libc
Copy link
Contributor

I'm able to reproduce on debian 32 bit at commit 19c48e7

@zonkzonk
Copy link
Contributor Author

yes I forgot -c "aa"

@ret2libc
Copy link
Contributor

ret2libc commented Aug 1, 2015

please test with 19bcaff

@zonkzonk
Copy link
Contributor Author

zonkzonk commented Aug 1, 2015

Thank you! Can't reproduce in 19bcaff.

@zonkzonk zonkzonk closed this as completed Aug 1, 2015
@jjdredd
Copy link
Contributor

jjdredd commented Nov 7, 2015

think this needs to be reopened
segfault after aa
linux x86, 24f675e

file: http://jjdredd.github.io/game.xz

#0  _int_malloc (av=av@entry=0xb6564440 <main_arena>, bytes=bytes@entry=228)
    at malloc.c:3291
#1  0xb6442b86 in __GI___libc_malloc (bytes=228) at malloc.c:2890
#2  0xb6f03df9 in cs_disasm (ud=2817775720, buffer=0xbfeb9bdc "\200\071", 
    size=8096, offset=147480786, count=1, insn=0xbfeb7678) at cs.c:551
#3  0xb6ed15b8 in analop (a=0xb863ca70, op=0xbfeb795c, addr=147480786, 
    buf=0xbfeb9bdc "\200\071", len=8096)
    at /home/ragim/sources/work/radare2/libr/..//libr/anal/p/anal_x86_cs.c:237
#4  0xb6ee3d70 in r_anal_op (anal=0xb863ca70, op=0xbfeb795c, addr=147480786, 
    data=0xbfeb9bdc "\200\071", len=8096) at op.c:65
#5  0xb6ee62a3 in fcn_recurse (anal=0xb863ca70, fcn=0xa7751d60, 
    addr=147480786, buf=0xbfeb9bdc "\200\071", len=8096, depth=495)
    at fcn.c:290
#6  0xb6ee7262 in fcn_recurse (anal=0xb863ca70, fcn=0xa7751d60, 
    addr=147481555, buf=0xbfebbd7c "\211\006\351\370\374\377\377\307\004$", 
    len=8096, depth=496) at fcn.c:461
#7  0xb6ee7a5a in fcn_recurse (anal=0xb863ca70, fcn=0xa7751d60, 
    addr=147481523, 
    buf=0xbfebdf1c "\211T$$\211L$(\211\034$\350\035\305\377\377\213T$$\213L$(\205\300\211D$,t\032\211\006\351\370\374\377\377\307\004$", len=8096, depth=497)
    at fcn.c:560
#8  0xb6ee79e8 in fcn_recurse (anal=0xb863ca70, fcn=0xa7751d60, 
---Type <return> to continue, or q <return> to quit---
    addr=147480769, buf=0xbfec00bc "\213\006\205\300\211D$,\017\204\344\002", 
    len=8096, depth=498) at fcn.c:559
#9  0xb6ee79e8 in fcn_recurse (anal=0xb863ca70, fcn=0xa7751d60, 
    addr=147481456, buf=0xbfec225c "\367\307\001", len=8096, depth=499)
    at fcn.c:559
#10 0xb6ee79e8 in fcn_recurse (anal=0xb863ca70, fcn=0xa7751d60, 
    addr=147480751, buf=0xbfec43fc "\203\373\036\017\204\270\002", len=8096, 
    depth=500) at fcn.c:559
#11 0xb6ee79e8 in fcn_recurse (anal=0xb863ca70, fcn=0xa7751d60, 
    addr=147481232, buf=0xbfec659c "\201\373\n\001", len=8096, depth=501)
    at fcn.c:559
#12 0xb6ee79e8 in fcn_recurse (anal=0xb863ca70, fcn=0xa7751d60, 
    addr=147481168, buf=0xbfec873c "\201\373\002\001", len=8096, depth=502)
    at fcn.c:559
#13 0xb6ee79e8 in fcn_recurse (anal=0xb863ca70, fcn=0xa7751d60, 
    addr=147480857, buf=0xbfeca8dc "\017\217\061\001", len=8096, depth=503)
    at fcn.c:559
#14 0xb6ee7a5a in fcn_recurse (anal=0xb863ca70, fcn=0xa7751d60, 
    addr=147480848, buf=0xbfecca7c "\203\373\n\017\204?\001", len=8096, 
    depth=504) at fcn.c:560
#15 0xb6ee79e8 in fcn_recurse (anal=0xb863ca70, fcn=0xa7751d60, 
    addr=147480719, buf=0xbfecec1c "\177\177\203\373\002\017\204\276\001", 
---Type <return> to continue, or q <return> to quit---
    len=8096, depth=505) at fcn.c:559
#16 0xb6ee79e8 in fcn_recurse (anal=0xb863ca70, fcn=0xa7751d60, 
    addr=147480963, 
    buf=0xbfed0dbc "\203\373\005\211\362\215u\004\017\205\376\376\377\377\205\377\017\205\267\001", len=8096, depth=506) at fcn.c:559
#17 0xb6ee79e8 in fcn_recurse (anal=0xb863ca70, fcn=0xa7751d60, 
    addr=147480930, buf=0xbfed2f5c "9]", len=8096, depth=507) at fcn.c:559
#18 0xb6ee7262 in fcn_recurse (anal=0xb863ca70, fcn=0xa7751d60, 
    addr=147481516, 
    buf=0xbfed50fc "\211\006\351\257\375\377\377\211T$$\211L$(\211\034$\350\035\305\377\377\213T$$\213L$(\205\300\211D$,t\032\211\006\351\370\374\377\377\307\004$", len=8096, depth=508) at fcn.c:461
#19 0xb6ee7a5a in fcn_recurse (anal=0xb863ca70, fcn=0xa7751d60, 
    addr=147481497, buf=0xbfed729c "\211L$(\350\236=", len=8096, depth=509)
    at fcn.c:560
#20 0xb6ee79e8 in fcn_recurse (anal=0xb863ca70, fcn=0xa7751d60, 
    addr=147480920, buf=0xbfed943c "\213.\205\355\017\204\067\002", len=8096, 
    depth=510) at fcn.c:559
#21 0xb6ee79e8 in fcn_recurse (anal=0xb863ca70, fcn=0xa7751d60, 
    addr=147480696, 
    buf=0xbfedb5dc "1\355\061҃x\004\374\017\204", <incomplete sequence \322>, 
    len=8096, depth=511) at fcn.c:559
---Type <return> to continue, or q <return> to quit---
#22 0xb6ee79e8 in fcn_recurse (anal=0xb863ca70, fcn=0xa7751d60, 
    addr=147480592, 
    buf=0xa7753df0 "\203\354L\213D$d\211\\$<\213L$`\211t$@\213\\$\\\211|$D\213t$P\213P\020\211l$H\213|$X\205\322t:\213R\024\205\322t3\211D$\024\213D$T\211L$\020\211\\$\f\211|$\b\211D$\004\211\064$\377ҋ\\$<\213t$@\213|$D\213l$H\203\304L\303f\220\061\355\061҃x\004\374\017\204", <incomplete sequence \322>, len=1024, 
    depth=512) at fcn.c:559
#23 0xb6ee7fdf in r_anal_fcn (anal=0xb863ca70, fcn=0xa7751d60, addr=147480592, 
    buf=0xa7753df0 "\203\354L\213D$d\211\\$<\213L$`\211t$@\213\\$\\\211|$D\213t$P\213P\020\211l$H\213|$X\205\322t:\213R\024\205\322t3\211D$\024\213D$T\211L$\020\211\\$\f\211|$\b\211D$\004\211\064$\377ҋ\\$<\213t$@\213|$D\213l$H\203\304L\303f\220\061\355\061҃x\004\374\017\204", <incomplete sequence \322>, len=1024, 
    reftype=0) at fcn.c:639
#24 0xb76b25cf in core_anal_fcn (core=0xb7777380 <r>, at=147480592, 
    from=18446744073709551615, reftype=0, depth=16) at anal.c:277
#25 0xb76b5033 in r_core_anal_fcn (core=0xb7777380 <r>, at=147480592, 
    from=18446744073709551615, reftype=0, depth=16) at anal.c:955
#26 0xb76b82f8 in r_core_anal_all (core=0xb7777380 <r>) at anal.c:1719
#27 0xb765b073 in cmd_anal_all (core=0xb7777380 <r>, input=0xa7f3bfd2 "")
    at cmd_anal.c:3024
#28 0xb765b70f in cmd_anal (data=0xb7777380 <r>, input=0xa7f3bfd1 "a")
    at cmd_anal.c:3151
---Type <return> to continue, or q <return> to quit---
#29 0xb76b03a3 in r_cmd_call (cmd=0xb866f400, input=0xa7f3bfd0 "aa")
    at cmd_api.c:210
#30 0xb7681fad in r_core_cmd_subst_i (core=0xb7777380 <r>, 
    cmd=0xa7f3bfd0 "aa", colon=0x0) at cmd.c:1702
#31 0xb767ffa3 in r_core_cmd_subst (core=0xb7777380 <r>, cmd=0xa7f3bfd0 "aa")
    at cmd.c:1164
#32 0xb76834cb in r_core_cmd (core=0xb7777380 <r>, cstr=0xb8625160 "aa", log=1)
    at cmd.c:2111
#33 0xb7635c2f in r_core_prompt_exec (r=0xb7777380 <r>) at core.c:1448
#34 0xb7773965 in main (argc=2, argv=0xbfede6a4, envp=0xbfede6b0)
    at radare2.c:795

@radare
Copy link
Collaborator

radare commented Nov 7, 2015

cant reproduce. it just takes a lot of time and memory, but i dont see
any crash on linux+asan

On 11/07/2015 12:21 PM, Judge_Dredd wrote:

think this needs to be reopened
linux x86, 24f675e

file: http://jjdredd.github.io/game.xz

#0  _int_malloc (av=av@entry=0xb6564440 <main_arena>, bytes=bytes@entry=228)
    at malloc.c:3291
#1  0xb6442b86 in __GI___libc_malloc (bytes=228) at malloc.c:2890
#2  0xb6f03df9 in cs_disasm (ud=2817775720, buffer=0xbfeb9bdc "\200\071", 
    size=8096, offset=147480786, count=1, insn=0xbfeb7678) at cs.c:551
#3  0xb6ed15b8 in analop (a=0xb863ca70, op=0xbfeb795c, addr=147480786, 
    buf=0xbfeb9bdc "\200\071", len=8096)
    at /home/ragim/sources/work/radare2/libr/..//libr/anal/p/anal_x86_cs.c:237
#4  0xb6ee3d70 in r_anal_op (anal=0xb863ca70, op=0xbfeb795c, addr=147480786, 
    data=0xbfeb9bdc "\200\071", len=8096) at op.c:65
#5  0xb6ee62a3 in fcn_recurse (anal=0xb863ca70, fcn=0xa7751d60, 
    addr=147480786, buf=0xbfeb9bdc "\200\071", len=8096, depth=495)
    at fcn.c:290
#6  0xb6ee7262 in fcn_recurse (anal=0xb863ca70, fcn=0xa7751d60, 
    addr=147481555, buf=0xbfebbd7c "\211\006\351\370\374\377\377\307\004$", 
    len=8096, depth=496) at fcn.c:461
#7  0xb6ee7a5a in fcn_recurse (anal=0xb863ca70, fcn=0xa7751d60, 
    addr=147481523, 
    buf=0xbfebdf1c "\211T$$\211L$(\211\034$\350\035\305\377\377\213T$$\213L$(\205\300\211D$,t\032\211\006\351\370\374\377\377\307\004$", len=8096, depth=497)
    at fcn.c:560
#8  0xb6ee79e8 in fcn_recurse (anal=0xb863ca70, fcn=0xa7751d60, 
---Type <return> to continue, or q <return> to quit---
    addr=147480769, buf=0xbfec00bc "\213\006\205\300\211D$,\017\204\344\002", 
    len=8096, depth=498) at fcn.c:559
#9  0xb6ee79e8 in fcn_recurse (anal=0xb863ca70, fcn=0xa7751d60, 
    addr=147481456, buf=0xbfec225c "\367\307\001", len=8096, depth=499)
    at fcn.c:559
#10 0xb6ee79e8 in fcn_recurse (anal=0xb863ca70, fcn=0xa7751d60, 
    addr=147480751, buf=0xbfec43fc "\203\373\036\017\204\270\002", len=8096, 
    depth=500) at fcn.c:559
#11 0xb6ee79e8 in fcn_recurse (anal=0xb863ca70, fcn=0xa7751d60, 
    addr=147481232, buf=0xbfec659c "\201\373\n\001", len=8096, depth=501)
    at fcn.c:559
#12 0xb6ee79e8 in fcn_recurse (anal=0xb863ca70, fcn=0xa7751d60, 
    addr=147481168, buf=0xbfec873c "\201\373\002\001", len=8096, depth=502)
    at fcn.c:559
#13 0xb6ee79e8 in fcn_recurse (anal=0xb863ca70, fcn=0xa7751d60, 
    addr=147480857, buf=0xbfeca8dc "\017\217\061\001", len=8096, depth=503)
    at fcn.c:559
#14 0xb6ee7a5a in fcn_recurse (anal=0xb863ca70, fcn=0xa7751d60, 
    addr=147480848, buf=0xbfecca7c "\203\373\n\017\204?\001", len=8096, 
    depth=504) at fcn.c:560
#15 0xb6ee79e8 in fcn_recurse (anal=0xb863ca70, fcn=0xa7751d60, 
    addr=147480719, buf=0xbfecec1c "\177\177\203\373\002\017\204\276\001", 
---Type <return> to continue, or q <return> to quit---
    len=8096, depth=505) at fcn.c:559
#16 0xb6ee79e8 in fcn_recurse (anal=0xb863ca70, fcn=0xa7751d60, 
    addr=147480963, 
    buf=0xbfed0dbc "\203\373\005\211\362\215u\004\017\205\376\376\377\377\205\377\017\205\267\001", len=8096, depth=506) at fcn.c:559
#17 0xb6ee79e8 in fcn_recurse (anal=0xb863ca70, fcn=0xa7751d60, 
    addr=147480930, buf=0xbfed2f5c "9]", len=8096, depth=507) at fcn.c:559
#18 0xb6ee7262 in fcn_recurse (anal=0xb863ca70, fcn=0xa7751d60, 
    addr=147481516, 
    buf=0xbfed50fc "\211\006\351\257\375\377\377\211T$$\211L$(\211\034$\350\035\305\377\377\213T$$\213L$(\205\300\211D$,t\032\211\006\351\370\374\377\377\307\004$", len=8096, depth=508) at fcn.c:461
#19 0xb6ee7a5a in fcn_recurse (anal=0xb863ca70, fcn=0xa7751d60, 
    addr=147481497, buf=0xbfed729c "\211L$(\350\236=", len=8096, depth=509)
    at fcn.c:560
#20 0xb6ee79e8 in fcn_recurse (anal=0xb863ca70, fcn=0xa7751d60, 
    addr=147480920, buf=0xbfed943c "\213.\205\355\017\204\067\002", len=8096, 
    depth=510) at fcn.c:559
#21 0xb6ee79e8 in fcn_recurse (anal=0xb863ca70, fcn=0xa7751d60, 
    addr=147480696, 
    buf=0xbfedb5dc "1\355\061҃x\004\374\017\204", <incomplete sequence \322>, 
    len=8096, depth=511) at fcn.c:559
---Type <return> to continue, or q <return> to quit---
#22 0xb6ee79e8 in fcn_recurse (anal=0xb863ca70, fcn=0xa7751d60, 
    addr=147480592, 
    buf=0xa7753df0 "\203\354L\213D$d\211\\$<\213L$`\211t$@\213\\$\\\211|$D\213t$P\213P\020\211l$H\213|$X\205\322t:\213R\024\205\322t3\211D$\024\213D$T\211L$\020\211\\$\f\211|$\b\211D$\004\211\064$\377ҋ\\$<\213t$@\213|$D\213l$H\203\304L\303f\220\061\355\061҃x\004\374\017\204", <incomplete sequence \322>, len=1024, 
    depth=512) at fcn.c:559
#23 0xb6ee7fdf in r_anal_fcn (anal=0xb863ca70, fcn=0xa7751d60, addr=147480592, 
    buf=0xa7753df0 "\203\354L\213D$d\211\\$<\213L$`\211t$@\213\\$\\\211|$D\213t$P\213P\020\211l$H\213|$X\205\322t:\213R\024\205\322t3\211D$\024\213D$T\211L$\020\211\\$\f\211|$\b\211D$\004\211\064$\377ҋ\\$<\213t$@\213|$D\213l$H\203\304L\303f\220\061\355\061҃x\004\374\017\204", <incomplete sequence \322>, len=1024, 
    reftype=0) at fcn.c:639
#24 0xb76b25cf in core_anal_fcn (core=0xb7777380 <r>, at=147480592, 
    from=18446744073709551615, reftype=0, depth=16) at anal.c:277
#25 0xb76b5033 in r_core_anal_fcn (core=0xb7777380 <r>, at=147480592, 
    from=18446744073709551615, reftype=0, depth=16) at anal.c:955
#26 0xb76b82f8 in r_core_anal_all (core=0xb7777380 <r>) at anal.c:1719
#27 0xb765b073 in cmd_anal_all (core=0xb7777380 <r>, input=0xa7f3bfd2 "")
    at cmd_anal.c:3024
#28 0xb765b70f in cmd_anal (data=0xb7777380 <r>, input=0xa7f3bfd1 "a")
    at cmd_anal.c:3151
---Type <return> to continue, or q <return> to quit---
#29 0xb76b03a3 in r_cmd_call (cmd=0xb866f400, input=0xa7f3bfd0 "aa")
    at cmd_api.c:210
#30 0xb7681fad in r_core_cmd_subst_i (core=0xb7777380 <r>, 
    cmd=0xa7f3bfd0 "aa", colon=0x0) at cmd.c:1702
#31 0xb767ffa3 in r_core_cmd_subst (core=0xb7777380 <r>, cmd=0xa7f3bfd0 "aa")
    at cmd.c:1164
#32 0xb76834cb in r_core_cmd (core=0xb7777380 <r>, cstr=0xb8625160 "aa", log=1)
    at cmd.c:2111
#33 0xb7635c2f in r_core_prompt_exec (r=0xb7777380 <r>) at core.c:1448
#34 0xb7773965 in main (argc=2, argv=0xbfede6a4, envp=0xbfede6b0)
    at radare2.c:795

Reply to this email directly or view it on GitHub:
#3021 (comment)

@radare
Copy link
Collaborator

radare commented Nov 7, 2015

is this an oomkill in your side?

On 11/07/2015 12:21 PM, Judge_Dredd wrote:

think this needs to be reopened
linux x86, 24f675e

file: http://jjdredd.github.io/game.xz

#0  _int_malloc (av=av@entry=0xb6564440 <main_arena>, bytes=bytes@entry=228)
    at malloc.c:3291
#1  0xb6442b86 in __GI___libc_malloc (bytes=228) at malloc.c:2890
#2  0xb6f03df9 in cs_disasm (ud=2817775720, buffer=0xbfeb9bdc "\200\071", 
    size=8096, offset=147480786, count=1, insn=0xbfeb7678) at cs.c:551
#3  0xb6ed15b8 in analop (a=0xb863ca70, op=0xbfeb795c, addr=147480786, 
    buf=0xbfeb9bdc "\200\071", len=8096)
    at /home/ragim/sources/work/radare2/libr/..//libr/anal/p/anal_x86_cs.c:237
#4  0xb6ee3d70 in r_anal_op (anal=0xb863ca70, op=0xbfeb795c, addr=147480786, 
    data=0xbfeb9bdc "\200\071", len=8096) at op.c:65
#5  0xb6ee62a3 in fcn_recurse (anal=0xb863ca70, fcn=0xa7751d60, 
    addr=147480786, buf=0xbfeb9bdc "\200\071", len=8096, depth=495)
    at fcn.c:290
#6  0xb6ee7262 in fcn_recurse (anal=0xb863ca70, fcn=0xa7751d60, 
    addr=147481555, buf=0xbfebbd7c "\211\006\351\370\374\377\377\307\004$", 
    len=8096, depth=496) at fcn.c:461
#7  0xb6ee7a5a in fcn_recurse (anal=0xb863ca70, fcn=0xa7751d60, 
    addr=147481523, 
    buf=0xbfebdf1c "\211T$$\211L$(\211\034$\350\035\305\377\377\213T$$\213L$(\205\300\211D$,t\032\211\006\351\370\374\377\377\307\004$", len=8096, depth=497)
    at fcn.c:560
#8  0xb6ee79e8 in fcn_recurse (anal=0xb863ca70, fcn=0xa7751d60, 
---Type <return> to continue, or q <return> to quit---
    addr=147480769, buf=0xbfec00bc "\213\006\205\300\211D$,\017\204\344\002", 
    len=8096, depth=498) at fcn.c:559
#9  0xb6ee79e8 in fcn_recurse (anal=0xb863ca70, fcn=0xa7751d60, 
    addr=147481456, buf=0xbfec225c "\367\307\001", len=8096, depth=499)
    at fcn.c:559
#10 0xb6ee79e8 in fcn_recurse (anal=0xb863ca70, fcn=0xa7751d60, 
    addr=147480751, buf=0xbfec43fc "\203\373\036\017\204\270\002", len=8096, 
    depth=500) at fcn.c:559
#11 0xb6ee79e8 in fcn_recurse (anal=0xb863ca70, fcn=0xa7751d60, 
    addr=147481232, buf=0xbfec659c "\201\373\n\001", len=8096, depth=501)
    at fcn.c:559
#12 0xb6ee79e8 in fcn_recurse (anal=0xb863ca70, fcn=0xa7751d60, 
    addr=147481168, buf=0xbfec873c "\201\373\002\001", len=8096, depth=502)
    at fcn.c:559
#13 0xb6ee79e8 in fcn_recurse (anal=0xb863ca70, fcn=0xa7751d60, 
    addr=147480857, buf=0xbfeca8dc "\017\217\061\001", len=8096, depth=503)
    at fcn.c:559
#14 0xb6ee7a5a in fcn_recurse (anal=0xb863ca70, fcn=0xa7751d60, 
    addr=147480848, buf=0xbfecca7c "\203\373\n\017\204?\001", len=8096, 
    depth=504) at fcn.c:560
#15 0xb6ee79e8 in fcn_recurse (anal=0xb863ca70, fcn=0xa7751d60, 
    addr=147480719, buf=0xbfecec1c "\177\177\203\373\002\017\204\276\001", 
---Type <return> to continue, or q <return> to quit---
    len=8096, depth=505) at fcn.c:559
#16 0xb6ee79e8 in fcn_recurse (anal=0xb863ca70, fcn=0xa7751d60, 
    addr=147480963, 
    buf=0xbfed0dbc "\203\373\005\211\362\215u\004\017\205\376\376\377\377\205\377\017\205\267\001", len=8096, depth=506) at fcn.c:559
#17 0xb6ee79e8 in fcn_recurse (anal=0xb863ca70, fcn=0xa7751d60, 
    addr=147480930, buf=0xbfed2f5c "9]", len=8096, depth=507) at fcn.c:559
#18 0xb6ee7262 in fcn_recurse (anal=0xb863ca70, fcn=0xa7751d60, 
    addr=147481516, 
    buf=0xbfed50fc "\211\006\351\257\375\377\377\211T$$\211L$(\211\034$\350\035\305\377\377\213T$$\213L$(\205\300\211D$,t\032\211\006\351\370\374\377\377\307\004$", len=8096, depth=508) at fcn.c:461
#19 0xb6ee7a5a in fcn_recurse (anal=0xb863ca70, fcn=0xa7751d60, 
    addr=147481497, buf=0xbfed729c "\211L$(\350\236=", len=8096, depth=509)
    at fcn.c:560
#20 0xb6ee79e8 in fcn_recurse (anal=0xb863ca70, fcn=0xa7751d60, 
    addr=147480920, buf=0xbfed943c "\213.\205\355\017\204\067\002", len=8096, 
    depth=510) at fcn.c:559
#21 0xb6ee79e8 in fcn_recurse (anal=0xb863ca70, fcn=0xa7751d60, 
    addr=147480696, 
    buf=0xbfedb5dc "1\355\061҃x\004\374\017\204", <incomplete sequence \322>, 
    len=8096, depth=511) at fcn.c:559
---Type <return> to continue, or q <return> to quit---
#22 0xb6ee79e8 in fcn_recurse (anal=0xb863ca70, fcn=0xa7751d60, 
    addr=147480592, 
    buf=0xa7753df0 "\203\354L\213D$d\211\\$<\213L$`\211t$@\213\\$\\\211|$D\213t$P\213P\020\211l$H\213|$X\205\322t:\213R\024\205\322t3\211D$\024\213D$T\211L$\020\211\\$\f\211|$\b\211D$\004\211\064$\377ҋ\\$<\213t$@\213|$D\213l$H\203\304L\303f\220\061\355\061҃x\004\374\017\204", <incomplete sequence \322>, len=1024, 
    depth=512) at fcn.c:559
#23 0xb6ee7fdf in r_anal_fcn (anal=0xb863ca70, fcn=0xa7751d60, addr=147480592, 
    buf=0xa7753df0 "\203\354L\213D$d\211\\$<\213L$`\211t$@\213\\$\\\211|$D\213t$P\213P\020\211l$H\213|$X\205\322t:\213R\024\205\322t3\211D$\024\213D$T\211L$\020\211\\$\f\211|$\b\211D$\004\211\064$\377ҋ\\$<\213t$@\213|$D\213l$H\203\304L\303f\220\061\355\061҃x\004\374\017\204", <incomplete sequence \322>, len=1024, 
    reftype=0) at fcn.c:639
#24 0xb76b25cf in core_anal_fcn (core=0xb7777380 <r>, at=147480592, 
    from=18446744073709551615, reftype=0, depth=16) at anal.c:277
#25 0xb76b5033 in r_core_anal_fcn (core=0xb7777380 <r>, at=147480592, 
    from=18446744073709551615, reftype=0, depth=16) at anal.c:955
#26 0xb76b82f8 in r_core_anal_all (core=0xb7777380 <r>) at anal.c:1719
#27 0xb765b073 in cmd_anal_all (core=0xb7777380 <r>, input=0xa7f3bfd2 "")
    at cmd_anal.c:3024
#28 0xb765b70f in cmd_anal (data=0xb7777380 <r>, input=0xa7f3bfd1 "a")
    at cmd_anal.c:3151
---Type <return> to continue, or q <return> to quit---
#29 0xb76b03a3 in r_cmd_call (cmd=0xb866f400, input=0xa7f3bfd0 "aa")
    at cmd_api.c:210
#30 0xb7681fad in r_core_cmd_subst_i (core=0xb7777380 <r>, 
    cmd=0xa7f3bfd0 "aa", colon=0x0) at cmd.c:1702
#31 0xb767ffa3 in r_core_cmd_subst (core=0xb7777380 <r>, cmd=0xa7f3bfd0 "aa")
    at cmd.c:1164
#32 0xb76834cb in r_core_cmd (core=0xb7777380 <r>, cstr=0xb8625160 "aa", log=1)
    at cmd.c:2111
#33 0xb7635c2f in r_core_prompt_exec (r=0xb7777380 <r>) at core.c:1448
#34 0xb7773965 in main (argc=2, argv=0xbfede6a4, envp=0xbfede6b0)
    at radare2.c:795

Reply to this email directly or view it on GitHub:
#3021 (comment)

@jjdredd
Copy link
Contributor

jjdredd commented Nov 7, 2015

If it gets oom'd with 2,5Gb RAM it's still a bug :)
It gets a segfault pretty soon though. OOM doesn't kill with segfault imho.

@radare
Copy link
Collaborator

radare commented Nov 7, 2015

memory consumption of the code analysis is something to be improved :)

but that's not a crash. you can fix this with hardware. i have 32GB of
ram here and the analaysis just finished fine

On 11/07/2015 12:30 PM, Judge_Dredd wrote:

If it gets oom'd with 2,5Gb RAM it's still a bug :)
It gets a segfault pretty soon though. OOM doesn't kill with segfault imho.


Reply to this email directly or view it on GitHub:
#3021 (comment)

@jjdredd
Copy link
Contributor

jjdredd commented Nov 7, 2015

Asan works fine for me too (I didn't wait for the analysis to finish but it didn't segfault).
The usual build segfaults.

@radare
Copy link
Collaborator

radare commented Nov 7, 2015

Haha :D

Will try without asan tonight. Asan build should take more memory and be more paranoic on memory accesses.

On 07 Nov 2015, at 12:48, Judge_Dredd [email protected] wrote:

Asan works fine for me too (I didn't wait for the analysis to finish but it didn't segfault).
The usual build segfaults.


Reply to this email directly or view it on GitHub.

@jjdredd
Copy link
Contributor

jjdredd commented Nov 8, 2015

Can someone pls confirm this?

@radare
Copy link
Collaborator

radare commented Nov 8, 2015

I can do some profiling to optimize the memory usage of the r2 code analysis.

On 08 Nov 2015, at 16:19, Judge_Dredd [email protected] wrote:

Can someone pls confirm this?


Reply to this email directly or view it on GitHub.

@radare
Copy link
Collaborator

radare commented Nov 8, 2015

no crash without asan here. But 900MB of ram needed to analyze a 17MB
binary seems too much to me :P so i'll improve it.

On 11/08/2015 04:19 PM, Judge_Dredd wrote:

Can someone pls confirm this?


Reply to this email directly or view it on GitHub:
#3021 (comment)

@radare
Copy link
Collaborator

radare commented Nov 8, 2015

According to massif, main memory usage comes from the Sdb storage when allocating SdbKv structures. 2015-11-08-171821_1680x1050_scrot

This struct contains a fixed size array to avoid unnecessary heap fragmentation for performance reasons:

typedef struct sdb_kv {
        char key[SDB_KSZ];
        char *value;
        int value_len;
        ut64 expire;
        ut32 cas;
} SdbKv;

This is a minimum of 255+8+4+8+4 = 285 bytes per key-value pair on 64bit. This can be reduced to something that it's easier to align like if we use pointers for key too. Also, moving the value_len to the end of the struct will allow us to get some better alignment and reduce that struct size.

@radare
Copy link
Collaborator

radare commented Nov 8, 2015

I'm also surprised by the amount of memory taken by RBin, here's a second run of massif without analyzing the program, the way to optimize this is not that obvious, so i'll take a deeper look later. If anyone wants to share his thoughs/patches you're welcome :)

2015-11-08-172925_1680x1050_scrot

@radare
Copy link
Collaborator

radare commented Nov 8, 2015

The yellow lines are caused by the RFlagItem struct which is really huge for the same reasons. I did a quick change and reduced memory usage from 80MB to 14MB, so I guess we can go this way for the rest of structs containing fixed size arrays :P i guess that performance will be worst for small bins, but better for big ones. because the heap allocator doesnt seems to manage big allocations as well as small ones.

@jjdredd
Copy link
Contributor

jjdredd commented Nov 8, 2015

I really don't feel like this is an oom issue.

@radare
Copy link
Collaborator

radare commented Nov 8, 2015

After dinner i will do all those mem optimizations. So you can try again

On 08 Nov 2015, at 18:10, Judge_Dredd [email protected] wrote:

I really don't feel like this is an oom issue.


Reply to this email directly or view it on GitHub.

@radare
Copy link
Collaborator

radare commented Nov 8, 2015

Anyway your backtrace doesnt shows any crash at all. Can you check syslog to confirm that oom thing? Can you also verify the instruction that is prpducing the crash if any? Not just the backtrace and the register values?

On 08 Nov 2015, at 18:10, Judge_Dredd [email protected] wrote:

I really don't feel like this is an oom issue.


Reply to this email directly or view it on GitHub.

@radare radare reopened this Nov 8, 2015
@radare radare added this to the 0.10.0 milestone Nov 8, 2015
@radare radare removed this from the 1.0.0 milestone Nov 8, 2015
@radare
Copy link
Collaborator

radare commented Nov 9, 2015

After all the optimizations mentioned done (well, almost all of them) I have managed to reduce the memory consuption of r2 from 630MB to 235MB. All tests are passing. There are still some minor things to be done, but, it will be good if you give it a try and confirm that the issue is gone

@radare
Copy link
Collaborator

radare commented Nov 9, 2015

The startup memory usage have been also improved from 346MB to 76MB. And it can be lowered to 50 or so. In fact, Just the Sdb change resulted in -150MB. Here there are some screenshots:
2015-11-09-052227_1680x1050_scrot

photo_2015-11-09_05-23-12

@jjdredd
Copy link
Contributor

jjdredd commented Nov 9, 2015

600-700 Mb I can afford, so I'm not out of memory imho.

aaccaea

Dump of assembler code for function _int_malloc:
   0xb63d9da0 <+0>: push   ebp
   0xb63d9da1 <+1>: push   edi
   0xb63d9da2 <+2>: push   esi
   0xb63d9da3 <+3>: push   ebx
   0xb63d9da4 <+4>: call   0xb6488e73 <__x86.get_pc_thunk.bx>
   0xb63d9da9 <+9>: add    ebx,0x123257
   0xb63d9daf <+15>:    sub    esp,0x8c
   0xb63d9db5 <+21>:    cmp    edx,0xffffffdf
=> 0xb63d9db8 <+24>:    mov    DWORD PTR [esp+0x48],edx
   0xb63d9dbc <+28>:    ja     0xb63da49c <_int_malloc+1788>
   0xb63d9dc2 <+34>:    mov    ebp,eax
   0xb63d9dc4 <+36>:    mov    eax,DWORD PTR [esp+0x48]
   0xb63d9dc8 <+40>:    mov    DWORD PTR [esp+0x40],0x10
   0xb63d9dd0 <+48>:    add    eax,0xb
   0xb63d9dd3 <+51>:    mov    edx,eax
   0xb63d9dd5 <+53>:    and    edx,0xfffffff8
   0xb63d9dd8 <+56>:    cmp    eax,0x10
   0xb63d9ddb <+59>:    cmovb  edx,DWORD PTR [esp+0x40]
   0xb63d9de0 <+64>:    cmp    edx,DWORD PTR [ebx+0x18e8]
   0xb63d9de6 <+70>:    mov    DWORD PTR [esp+0x40],edx
   0xb63d9dea <+74>:    ja     0xb63d9e80 <_int_malloc+224>
#0  _int_malloc (av=av@entry=0xb64fd440 <main_arena>, bytes=bytes@entry=128)
    at malloc.c:3291
#1  0xb63dc58e in __libc_calloc (n=1, elem_size=128) at malloc.c:3208
#2  0xb6e81957 in r_anal_bb_new () at bb.c:9
#3  0xb6e7e668 in appendBasicBlock (anal=0xb89acab0, fcn=0xa76579b0, 
    addr=138347078) at fcn.c:186
#4  0xb6e7e998 in fcn_recurse (anal=0xb89acab0, fcn=0xa76579b0, 
    addr=138347078, buf=0xbfda643c "\204\311\017\205\062\002", len=8096, 
    depth=486) at fcn.c:268
#5  0xb6e8036f in fcn_recurse (anal=0xb89acab0, fcn=0xa76579b0, 
    addr=138347048, buf=0xbfda85dc "\213F\b\271\001", len=8096, depth=487)
    at fcn.c:559
#6  0xb6e8036f in fcn_recurse (anal=0xb89acab0, fcn=0xa76579b0, 
    addr=138347062, 
    buf=0xbfdaa77c "\213V\020\071\327|\353\213F\f1Ʌ\300u\356\204\311\017\205\062\002", len=8096, depth=488) at fcn.c:559
#7  0xb6e8036f in fcn_recurse (anal=0xb89acab0, fcn=0xa76579b0, 
    addr=138347032, buf=0xbfdac91c "\213D$L\213p\b\205\366u\023\351Q\002", 
    len=8096, depth=489) at fcn.c:559
#8  0xb6e8036f in fcn_recurse (anal=0xb89acab0, fcn=0xa76579b0, 
    addr=138346624, buf=0xbfdaeabc "\205\377\017\205\220\001", len=8096, 
    depth=490) at fcn.c:559

@jjdredd
Copy link
Contributor

jjdredd commented Nov 9, 2015

=> 0xb63d9db8 <+24>:    mov    DWORD PTR [esp+0x48],edx

Was I really out of stack??
I tried with ulimit -s unlimited and now it doesn't crash (at least immediately), I will leave the analysis for some time to see how things go.

EDIT: Yup, aa finished without a crash.

@radare
Copy link
Collaborator

radare commented Nov 9, 2015

Yep. How small your stack is? I can reduce this requirement too

On 09 Nov 2015, at 10:40, Judge_Dredd [email protected] wrote:

=> 0xb63d9db8 <+24>: mov DWORD PTR [esp+0x48],edx
Was I really out of stack??
I tried with ulimit -s unlimited and now it doesn't crash (at least immediately), I will leave the analysis for some time to see how things go.


Reply to this email directly or view it on GitHub.

@radare
Copy link
Collaborator

radare commented Nov 9, 2015

your crash shows that the size of your stack is 64KB. Welcome to 2015

@radare
Copy link
Collaborator

radare commented Nov 9, 2015

Try again, i have moved this 8KB buffer from the stack to the heap.

@jjdredd
Copy link
Contributor

jjdredd commented Nov 9, 2015

I think it's even less: stack size (kbytes, -s) 8192.

yeh, I'm from 80's

@jjdredd
Copy link
Contributor

jjdredd commented Nov 9, 2015

TY @radare it seems to be fixed at 0811424

@radare radare closed this as completed Nov 9, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants