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

radare2 make gdbserver segmentation fault after set breakpoint and continue #10813

Closed
d4em0n opened this issue Jul 24, 2018 · 6 comments
Closed
Labels
gdb Remote GDB protocol support RDebug

Comments

@d4em0n
Copy link
Contributor

d4em0n commented Jul 24, 2018

Work environment

Questions Answers
OS/arch/bits (mandatory) KDE Neon (Ubuntu) x86_64
File format of the file you reverse (mandatory) ELF
Architecture/bits of the file (mandatory) ARM 32
r2 -v full output, not truncated (mandatory) radare2 2.8.0-git 18819 @ linux-x86-64 git.2.7.0-135-g4644d34 commit: 4644d34 build: 2018-07-24__22:27:26

Expected behavior

Like using gdb-multiarch it's doesn't make gdbserver segmentation fault.

Actual behavior

gdbserver segmentation fault if radare2 set breakpoint then continuing.

Steps to reproduce the behavior

[Terminal 1 inside qemu guest]

pi@raspberrypi:~ $ gdbserver --multi localhost:5000 ./path/to/bin
Process ./path/to/bin created; pid = 903
Listening on port 5000

[Terminal 2 host]

  % r2 -a arm -b 32 -D gdb gdb://127.0.0.1:5000                                                             
= attach 903 1
= attach 903 0
 -- You can 'copy/paste' bytes using the cursor in visual mode 'c' and using the 'y' and 'Y' keys
[0x00000000]> ie
[Entrypoints]
vaddr=0x0001082c paddr=0x0000082c baddr=0x00010000 laddr=0x00000000 haddr=0x00000018 type=program

1 entrypoints

[0x00000000]> pd 10 @ 0x0001082c
            ;-- entry0:
            ;-- section_end..plt:
            ;-- section..text:
            0x0001082c      00b0a0e3       mov fp, 0                   ; [13] -r-x section size 2976 named .text
            0x00010830      00e0a0e3       mov lr, 0
            0x00010834      04109de4       pop {r1}
            0x00010838      0d20a0e1       mov r2, sp
            0x0001083c      04202de5       str r2, [sp, -4]!
            0x00010840      04002de5       str r0, [sp, -4]!
            0x00010844      10c09fe5       ldr ip, [0x0001085c]        ; [0x1085c:4]=0x113c8
            0x00010848      04c02de5       str ip, [sp, -4]!
            0x0001084c      0c009fe5       ldr r0, [0x00010860]        ; [0x10860:4]=0x11284
            0x00010850      0c309fe5       ldr r3, [0x00010864]        ; [0x10864:4]=0x11368
[0x00000000]> db 0x00010850
[0x00000000]> dc
read_packet: read failed
read_packet: read failed
read_packet: read failed
read_packet: read failed
read_packet: read failed
read_packet: read failed

[Terminal 1 after dc command]

pi@raspberrypi:~ $ gdbserver --multi localhost:5000 ./mobile_bank.45115ff5f655d94fc26cb5244928b3fc
Process ./mobile_bank.45115ff5f655d94fc26cb5244928b3fc created; pid = 903
Listening on port 5000
Remote debugging from host 10.0.2.2
Segmentation fault

it's works using gdb-multiarch as gdb client.
gdbserver version:

pi@raspberrypi:~ $ gdbserver --version
GNU gdbserver (Raspbian 7.12-6) 7.12.0.20161007-git
Copyright (C) 2016 Free Software Foundation, Inc.
gdbserver is free software, covered by the GNU General Public License.
This gdbserver was configured as "arm-linux-gnueabihf"
@radare
Copy link
Collaborator

radare commented Jul 24, 2018 via email

@d4em0n
Copy link
Contributor Author

d4em0n commented Jul 25, 2018

I think radare2 not crash, but i don't know what the problem exactly. This backtrace shows whenever i quit radare2 (build with sys/asan.sh).

  % r2 -a arm -b 32 -D gdb gdb://127.0.0.1:5000                                                                                                                                           !4986
= attach 490 1
= attach 490 0
 -- How about a nice game of chess?
[0x00000000]> ie
[Entrypoints]
vaddr=0x0001082c paddr=0x0000082c baddr=0x00010000 laddr=0x00000000 haddr=0x00000018 type=program

1 entrypoints

[0x00000000]> pd 10 @ 0x0001082c
            ;-- entry0:
            ;-- section_end..plt:
            ;-- section..text:
            0x0001082c      00b0a0e3       mov fp, 0                   ; [13] -r-x section size 2976 named .text
            0x00010830      00e0a0e3       mov lr, 0
            0x00010834      04109de4       pop {r1}
            0x00010838      0d20a0e1       mov r2, sp
            0x0001083c      04202de5       str r2, [sp, -4]!
            0x00010840      04002de5       str r0, [sp, -4]!
            0x00010844      10c09fe5       ldr ip, [0x0001085c]        ; [0x1085c:4]=0x113c8
            0x00010848      04c02de5       str ip, [sp, -4]!
            0x0001084c      0c009fe5       ldr r0, [0x00010860]        ; [0x10860:4]=0x11284
            0x00010850      0c309fe5       ldr r3, [0x00010864]        ; [0x10864:4]=0x11368
[0x00000000]> db 0x0001084c
[0x00000000]> dc
read_packet: read failed
read_packet: read failed
read_packet: read failed
read_packet: read failed
read_packet: read failed
read_packet: read failed
[0x00000000]> exit
Do you want to quit? (Y/n) Y
Do you want to kill the process? (Y/n) Y

=================================================================
==32221==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 2440 byte(s) in 1 object(s) allocated from:
    #0 0x7f0b32cad961 in realloc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x98961)
    #1 0x7f0b325c875d in r_core_autocomplete_add /home/n0psledbyte/radare2/libr/core/core.c:3103
    #2 0x7f0b325bfc8e in init_autocomplete /home/n0psledbyte/radare2/libr/core/core.c:2006
    #3 0x7f0b325c260b in r_core_init /home/n0psledbyte/radare2/libr/core/core.c:2213
    #4 0x55f011af0a30 in main /home/n0psledbyte/radare2/binr/radare2/radare2.c:499
    #5 0x7f0b2c9bd82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)

Direct leak of 2112 byte(s) in 1 object(s) allocated from:
    #0 0x7f0b32cad602 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x98602)
    #1 0x7f0b2fa4b037 in gdbr_parse_target_xml src/gdbclient/xml.c:170
    #2 0x7f0b2fa4a2ad in gdbr_read_target_xml src/gdbclient/xml.c:23
    #3 0x7f0b2fa3fb0f in gdbr_connect src/gdbclient/core.c:191
    #4 0x7f0b2f9c4580 in __open p/io_gdb.c:117
    #5 0x7f0b2f9f60e4 in r_io_desc_open /home/n0psledbyte/radare2/libr/io/desc.c:105
    #6 0x7f0b2f9e8e41 in r_io_open_nomap /home/n0psledbyte/radare2/libr/io/io.c:260
    #7 0x7f0b32700e14 in r_core_file_open /home/n0psledbyte/radare2/libr/core/file.c:785
    #8 0x55f011af2d68 in main /home/n0psledbyte/radare2/binr/radare2/radare2.c:937
    #9 0x7f0b2c9bd82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)

Direct leak of 647 byte(s) in 1 object(s) allocated from:
    #0 0x7f0b32c7730f in strdup (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x6230f)
    #1 0x7f0b2fa4bb31 in gdbr_parse_target_xml src/gdbclient/xml.c:305
    #2 0x7f0b2fa4a2ad in gdbr_read_target_xml src/gdbclient/xml.c:23
    #3 0x7f0b2fa3fb0f in gdbr_connect src/gdbclient/core.c:191
    #4 0x7f0b2f9c4580 in __open p/io_gdb.c:117
    #5 0x7f0b2f9f60e4 in r_io_desc_open /home/n0psledbyte/radare2/libr/io/desc.c:105
    #6 0x7f0b2f9e8e41 in r_io_open_nomap /home/n0psledbyte/radare2/libr/io/io.c:260
    #7 0x7f0b32700e14 in r_core_file_open /home/n0psledbyte/radare2/libr/core/file.c:785
    #8 0x55f011af2d68 in main /home/n0psledbyte/radare2/binr/radare2/radare2.c:937
    #9 0x7f0b2c9bd82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)

Direct leak of 448 byte(s) in 7 object(s) allocated from:
    #0 0x7f0b32cad79a in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x9879a)
    #1 0x7f0b312b60c3 in r_debug_map_new /home/n0psledbyte/radare2/libr/debug/map.c:276
    #2 0x7f0b312d5ba2 in r_debug_gdb_map_get p/debug_gdb.c:214
    #3 0x7f0b312b63d6 in r_debug_map_sync /home/n0psledbyte/radare2/libr/debug/map.c:297
    #4 0x7f0b312b9bca in r_debug_bp_add /home/n0psledbyte/radare2/libr/debug/debug.c:302
    #5 0x7f0b3260231b in r_core_cmd_bp /home/n0psledbyte/radare2/libr/core/cmd_debug.c:3409
    #6 0x7f0b3260ba3c in cmd_debug /home/n0psledbyte/radare2/libr/core/cmd_debug.c:4641
    #7 0x7f0b32790910 in r_cmd_call /home/n0psledbyte/radare2/libr/core/cmd_api.c:237
    #8 0x7f0b326f2880 in r_core_cmd_subst_i /home/n0psledbyte/radare2/libr/core/cmd.c:2876
    #9 0x7f0b326eba78 in r_core_cmd_subst /home/n0psledbyte/radare2/libr/core/cmd.c:1905
    #10 0x7f0b326f7ce7 in r_core_cmd /home/n0psledbyte/radare2/libr/core/cmd.c:3580
    #11 0x7f0b325c4616 in r_core_prompt_exec /home/n0psledbyte/radare2/libr/core/core.c:2450
    #12 0x55f011af58cc in main /home/n0psledbyte/radare2/binr/radare2/radare2.c:1378
    #13 0x7f0b2c9bd82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)

Direct leak of 448 byte(s) in 7 object(s) allocated from:
    #0 0x7f0b32cad79a in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x9879a)
    #1 0x7f0b312b60c3 in r_debug_map_new /home/n0psledbyte/radare2/libr/debug/map.c:276
    #2 0x7f0b312d5ba2 in r_debug_gdb_map_get p/debug_gdb.c:214
    #3 0x7f0b312b63d6 in r_debug_map_sync /home/n0psledbyte/radare2/libr/debug/map.c:297
    #4 0x7f0b325fac47 in validAddress /home/n0psledbyte/radare2/libr/core/cmd_debug.c:2672
    #5 0x7f0b326022aa in r_core_cmd_bp /home/n0psledbyte/radare2/libr/core/cmd_debug.c:3408
    #6 0x7f0b3260ba3c in cmd_debug /home/n0psledbyte/radare2/libr/core/cmd_debug.c:4641
    #7 0x7f0b32790910 in r_cmd_call /home/n0psledbyte/radare2/libr/core/cmd_api.c:237
    #8 0x7f0b326f2880 in r_core_cmd_subst_i /home/n0psledbyte/radare2/libr/core/cmd.c:2876
    #9 0x7f0b326eba78 in r_core_cmd_subst /home/n0psledbyte/radare2/libr/core/cmd.c:1905
    #10 0x7f0b326f7ce7 in r_core_cmd /home/n0psledbyte/radare2/libr/core/cmd.c:3580
    #11 0x7f0b325c4616 in r_core_prompt_exec /home/n0psledbyte/radare2/libr/core/core.c:2450
    #12 0x55f011af58cc in main /home/n0psledbyte/radare2/binr/radare2/radare2.c:1378
    #13 0x7f0b2c9bd82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)

Direct leak of 448 byte(s) in 7 object(s) allocated from:
    #0 0x7f0b32cad79a in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x9879a)
    #1 0x7f0b312b60c3 in r_debug_map_new /home/n0psledbyte/radare2/libr/debug/map.c:276
    #2 0x7f0b312d5ba2 in r_debug_gdb_map_get p/debug_gdb.c:214
    #3 0x7f0b312b63d6 in r_debug_map_sync /home/n0psledbyte/radare2/libr/debug/map.c:297
    #4 0x7f0b312c2081 in r_debug_get_baddr /home/n0psledbyte/radare2/libr/debug/debug.c:1624
    #5 0x55f011af3114 in main /home/n0psledbyte/radare2/binr/radare2/radare2.c:973
    #6 0x7f0b2c9bd82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)

Direct leak of 350 byte(s) in 24 object(s) allocated from:
    #0 0x7f0b32c7730f in strdup (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x6230f)
    #1 0x7f0b315ac9f7 in r_bin_symbol_clone /home/n0psledbyte/radare2/libr/bin/bin.c:197
    #2 0x7f0b316251e8 in setsymord /home/n0psledbyte/radare2/libr/..//libr/bin/p/bin_elf.c:55
    #3 0x7f0b3162896b in insert_symbol /home/n0psledbyte/radare2/libr/..//libr/bin/p/bin_elf.c:504
    #4 0x7f0b31628dc8 in symbols /home/n0psledbyte/radare2/libr/..//libr/bin/p/bin_elf.c:562
    #5 0x7f0b315cf5db in r_bin_object_set_items /home/n0psledbyte/radare2/libr/bin/obj.c:173
    #6 0x7f0b315ce92c in r_bin_object_new /home/n0psledbyte/radare2/libr/bin/obj.c:95
    #7 0x7f0b315cabeb in r_bin_file_new_from_bytes /home/n0psledbyte/radare2/libr/bin/file.c:515
    #8 0x7f0b315ae3c7 in r_bin_load_io_at_offset_as_sz /home/n0psledbyte/radare2/libr/bin/bin.c:486
    #9 0x7f0b315ae444 in r_bin_load_io_at_offset_as /home/n0psledbyte/radare2/libr/bin/bin.c:500
    #10 0x7f0b315adad2 in r_bin_load_io /home/n0psledbyte/radare2/libr/bin/bin.c:384
    #11 0x7f0b315acf89 in r_bin_load /home/n0psledbyte/radare2/libr/bin/bin.c:256
    #12 0x7f0b315d1c65 in r_bin_open /home/n0psledbyte/radare2/libr/bin/open.c:32
    #13 0x7f0b326fd4ba in r_core_file_do_load_for_debug /home/n0psledbyte/radare2/libr/core/file.c:366
    #14 0x7f0b326fedf7 in r_core_bin_load /home/n0psledbyte/radare2/libr/core/file.c:581
    #15 0x55f011af3136 in main /home/n0psledbyte/radare2/binr/radare2/radare2.c:975
    #16 0x7f0b2c9bd82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)

Direct leak of 184 byte(s) in 1 object(s) allocated from:
    #0 0x7f0b32cad79a in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x9879a)
    #1 0x7f0b2fec4a1b in r_reg_arena_new /home/n0psledbyte/radare2/libr/reg/arena.c:169
    #2 0x7f0b2fec513d in r_reg_arena_push /home/n0psledbyte/radare2/libr/reg/arena.c:228
    #3 0x7f0b2feccfaf in r_reg_set_profile_string /home/n0psledbyte/radare2/libr/reg/profile.c:216
    #4 0x7f0b312c2965 in r_debug_use /home/n0psledbyte/radare2/libr/debug/plugin.c:36
    #5 0x7f0b3270deee in cb_dbgbackend /home/n0psledbyte/radare2/libr/core/cconfig.c:1229
    #6 0x7f0b31b03171 in r_config_set /home/n0psledbyte/radare2/libr/config/config.c:481
    #7 0x55f011af2c02 in main /home/n0psledbyte/radare2/binr/radare2/radare2.c:927
    #8 0x7f0b2c9bd82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)

Direct leak of 172 byte(s) in 1 object(s) allocated from:
    #0 0x7f0b32cad79a in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x9879a)
    #1 0x7f0b2d10b81d in sdb_decode /home/n0psledbyte/radare2/shlr/sdb/src/base64.c:101
    #2 0x7f0b305f1a61 in r_meta_deserialize_val /home/n0psledbyte/radare2/libr/anal/meta.c:342
    #3 0x7f0b305f23d6 in r_meta_find /home/n0psledbyte/radare2/libr/anal/meta.c:420
    #4 0x7f0b305f589f in r_anal_reflines_get /home/n0psledbyte/radare2/libr/anal/reflines.c:120
    #5 0x7f0b327dbe5d in ds_reflines_init /home/n0psledbyte/radare2/libr/core/disasm.c:791
    #6 0x7f0b327ff49b in r_core_print_disasm /home/n0psledbyte/radare2/libr/core/disasm.c:4541
    #7 0x7f0b326b44fa in cmd_print /home/n0psledbyte/radare2/libr/core/cmd_print.c:4482
    #8 0x7f0b32790910 in r_cmd_call /home/n0psledbyte/radare2/libr/core/cmd_api.c:237
    #9 0x7f0b326f22bf in r_core_cmd_subst_i /home/n0psledbyte/radare2/libr/core/cmd.c:2832
    #10 0x7f0b326eba78 in r_core_cmd_subst /home/n0psledbyte/radare2/libr/core/cmd.c:1905
    #11 0x7f0b326f7ce7 in r_core_cmd /home/n0psledbyte/radare2/libr/core/cmd.c:3580
    #12 0x7f0b325c4616 in r_core_prompt_exec /home/n0psledbyte/radare2/libr/core/core.c:2450
    #13 0x55f011af58cc in main /home/n0psledbyte/radare2/binr/radare2/radare2.c:1378
    #14 0x7f0b2c9bd82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)

Direct leak of 105 byte(s) in 7 object(s) allocated from:
    #0 0x7f0b32cad602 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x98602)
    #1 0x7f0b2d10f8fc in sdb_array_set /home/n0psledbyte/radare2/shlr/sdb/src/array.c:381
    #2 0x7f0b30619e87 in setHint /home/n0psledbyte/radare2/libr/anal/hint.c:48
    #3 0x7f0b3061a3b2 in r_anal_hint_set_bits /home/n0psledbyte/radare2/libr/anal/hint.c:115
    #4 0x7f0b327743f1 in bin_symbols_internal /home/n0psledbyte/radare2/libr/core/cbin.c:1861
    #5 0x7f0b32775ecf in bin_symbols /home/n0psledbyte/radare2/libr/core/cbin.c:2064
    #6 0x7f0b3277f215 in r_core_bin_info /home/n0psledbyte/radare2/libr/core/cbin.c:3382
    #7 0x7f0b327675f1 in r_core_bin_set_env /home/n0psledbyte/radare2/libr/core/cbin.c:119
    #8 0x7f0b326fd70c in r_core_file_do_load_for_debug /home/n0psledbyte/radare2/libr/core/file.c:389
    #9 0x7f0b326fedf7 in r_core_bin_load /home/n0psledbyte/radare2/libr/core/file.c:581
    #10 0x55f011af3136 in main /home/n0psledbyte/radare2/binr/radare2/radare2.c:975
    #11 0x7f0b2c9bd82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)

Direct leak of 76 byte(s) in 1 object(s) allocated from:
    #0 0x7f0b32cad79a in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x9879a)
    #1 0x7f0b2fec4a1b in r_reg_arena_new /home/n0psledbyte/radare2/libr/reg/arena.c:169
    #2 0x7f0b2fec513d in r_reg_arena_push /home/n0psledbyte/radare2/libr/reg/arena.c:228
    #3 0x7f0b2feccfaf in r_reg_set_profile_string /home/n0psledbyte/radare2/libr/reg/profile.c:216
    #4 0x7f0b327092c6 in cb_asmbits /home/n0psledbyte/radare2/libr/core/cconfig.c:604
    #5 0x7f0b31b03171 in r_config_set /home/n0psledbyte/radare2/libr/config/config.c:481
    #6 0x55f011af4a1c in main /home/n0psledbyte/radare2/binr/radare2/radare2.c:1207
    #7 0x7f0b2c9bd82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)

Direct leak of 38 byte(s) in 4 object(s) allocated from:
    #0 0x7f0b32c7730f in strdup (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x6230f)
    #1 0x7f0b315ac9f7 in r_bin_symbol_clone /home/n0psledbyte/radare2/libr/bin/bin.c:197
    #2 0x7f0b316251e8 in setsymord /home/n0psledbyte/radare2/libr/..//libr/bin/p/bin_elf.c:55
    #3 0x7f0b3162896b in insert_symbol /home/n0psledbyte/radare2/libr/..//libr/bin/p/bin_elf.c:504
    #4 0x7f0b31628ba4 in symbols /home/n0psledbyte/radare2/libr/..//libr/bin/p/bin_elf.c:539
    #5 0x7f0b315cf5db in r_bin_object_set_items /home/n0psledbyte/radare2/libr/bin/obj.c:173
    #6 0x7f0b315ce92c in r_bin_object_new /home/n0psledbyte/radare2/libr/bin/obj.c:95
    #7 0x7f0b315cabeb in r_bin_file_new_from_bytes /home/n0psledbyte/radare2/libr/bin/file.c:515
    #8 0x7f0b315ae3c7 in r_bin_load_io_at_offset_as_sz /home/n0psledbyte/radare2/libr/bin/bin.c:486
    #9 0x7f0b315ae444 in r_bin_load_io_at_offset_as /home/n0psledbyte/radare2/libr/bin/bin.c:500
    #10 0x7f0b315adad2 in r_bin_load_io /home/n0psledbyte/radare2/libr/bin/bin.c:384
    #11 0x7f0b315acf89 in r_bin_load /home/n0psledbyte/radare2/libr/bin/bin.c:256
    #12 0x7f0b315d1c65 in r_bin_open /home/n0psledbyte/radare2/libr/bin/open.c:32
    #13 0x7f0b326fd4ba in r_core_file_do_load_for_debug /home/n0psledbyte/radare2/libr/core/file.c:366
    #14 0x7f0b326fedf7 in r_core_bin_load /home/n0psledbyte/radare2/libr/core/file.c:581
    #15 0x55f011af3136 in main /home/n0psledbyte/radare2/binr/radare2/radare2.c:975
    #16 0x7f0b2c9bd82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)

Direct leak of 32 byte(s) in 1 object(s) allocated from:
    #0 0x7f0b32cad79a in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x9879a)
    #1 0x7f0b2be4448d in r_socket_new /home/n0psledbyte/radare2/libr/socket/socket.c:184
    #2 0x7f0b2fa3954e in gdbr_init src/libgdbr.c:32
    #3 0x7f0b2f9c4561 in __open p/io_gdb.c:115
    #4 0x7f0b2f9f60e4 in r_io_desc_open /home/n0psledbyte/radare2/libr/io/desc.c:105
    #5 0x7f0b2f9e8e41 in r_io_open_nomap /home/n0psledbyte/radare2/libr/io/io.c:260
    #6 0x7f0b32700e14 in r_core_file_open /home/n0psledbyte/radare2/libr/core/file.c:785
    #7 0x55f011af2d68 in main /home/n0psledbyte/radare2/binr/radare2/radare2.c:937
    #8 0x7f0b2c9bd82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)

Direct leak of 21 byte(s) in 1 object(s) allocated from:
    #0 0x7f0b32c7730f in strdup (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x6230f)
    #1 0x55f011af1be8 in main /home/n0psledbyte/radare2/binr/radare2/radare2.c:749
    #2 0x7f0b2c9bd82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)

Direct leak of 21 byte(s) in 1 object(s) allocated from:
    #0 0x7f0b32c7730f in strdup (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x6230f)
    #1 0x55f011af2cc0 in main /home/n0psledbyte/radare2/binr/radare2/radare2.c:930
    #2 0x7f0b2c9bd82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)

Direct leak of 8 byte(s) in 1 object(s) allocated from:
    #0 0x7f0b32cad961 in realloc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x98961)
    #1 0x7f0b325c875d in r_core_autocomplete_add /home/n0psledbyte/radare2/libr/core/core.c:3103
    #2 0x7f0b325bfb10 in init_autocomplete /home/n0psledbyte/radare2/libr/core/core.c:1999
    #3 0x7f0b325c260b in r_core_init /home/n0psledbyte/radare2/libr/core/core.c:2213
    #4 0x55f011af0a30 in main /home/n0psledbyte/radare2/binr/radare2/radare2.c:499
    #5 0x7f0b2c9bd82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)

Direct leak of 4 byte(s) in 1 object(s) allocated from:
    #0 0x7f0b32c7730f in strdup (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x6230f)
    #1 0x7f0b2d03dae0 in r_str_new /home/n0psledbyte/radare2/libr/util/str.c:663
    #2 0x7f0b2d03deb4 in r_str_newf /home/n0psledbyte/radare2/libr/util/str.c:724
    #3 0x7f0b2f9c5447 in __system p/io_gdb.c:279
    #4 0x7f0b2f9eb053 in r_io_system /home/n0psledbyte/radare2/libr/io/io.c:628
    #5 0x7f0b312bc392 in r_debug_select /home/n0psledbyte/radare2/libr/debug/debug.c:589
    #6 0x7f0b312c2075 in r_debug_get_baddr /home/n0psledbyte/radare2/libr/debug/debug.c:1623
    #7 0x55f011af3114 in main /home/n0psledbyte/radare2/binr/radare2/radare2.c:973
    #8 0x7f0b2c9bd82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)

Direct leak of 4 byte(s) in 1 object(s) allocated from:
    #0 0x7f0b32c7730f in strdup (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x6230f)
    #1 0x7f0b2d03dae0 in r_str_new /home/n0psledbyte/radare2/libr/util/str.c:663
    #2 0x7f0b2d03deb4 in r_str_newf /home/n0psledbyte/radare2/libr/util/str.c:724
    #3 0x7f0b2f9c5447 in __system p/io_gdb.c:279
    #4 0x7f0b2f9eb053 in r_io_system /home/n0psledbyte/radare2/libr/io/io.c:628
    #5 0x7f0b312bc392 in r_debug_select /home/n0psledbyte/radare2/libr/debug/debug.c:589
    #6 0x7f0b326fd340 in r_core_file_do_load_for_debug /home/n0psledbyte/radare2/libr/core/file.c:345
    #7 0x7f0b326fedf7 in r_core_bin_load /home/n0psledbyte/radare2/libr/core/file.c:581
    #8 0x55f011af3136 in main /home/n0psledbyte/radare2/binr/radare2/radare2.c:975
    #9 0x7f0b2c9bd82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)

Direct leak of 4 byte(s) in 1 object(s) allocated from:
    #0 0x7f0b32c7730f in strdup (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x6230f)
    #1 0x7f0b2d03dae0 in r_str_new /home/n0psledbyte/radare2/libr/util/str.c:663
    #2 0x7f0b2d03deb4 in r_str_newf /home/n0psledbyte/radare2/libr/util/str.c:724
    #3 0x7f0b2f9c5447 in __system p/io_gdb.c:279
    #4 0x7f0b2f9eb053 in r_io_system /home/n0psledbyte/radare2/libr/io/io.c:628
    #5 0x7f0b312bc392 in r_debug_select /home/n0psledbyte/radare2/libr/debug/debug.c:589
    #6 0x7f0b3270bad4 in cb_cfgdebug /home/n0psledbyte/radare2/libr/core/cconfig.c:953
    #7 0x7f0b31b03bb5 in r_config_set_i /home/n0psledbyte/radare2/libr/config/config.c:586
    #8 0x7f0b32734f5b in r_core_setup_debugger /home/n0psledbyte/radare2/libr/core/cio.c:12
    #9 0x55f011af4ba8 in main /home/n0psledbyte/radare2/binr/radare2/radare2.c:1216
    #10 0x7f0b2c9bd82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)

Indirect leak of 208 byte(s) in 7 object(s) allocated from:
    #0 0x7f0b32c7730f in strdup (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x6230f)
    #1 0x7f0b312b60e4 in r_debug_map_new /home/n0psledbyte/radare2/libr/debug/map.c:280
    #2 0x7f0b312d5ba2 in r_debug_gdb_map_get p/debug_gdb.c:214
    #3 0x7f0b312b63d6 in r_debug_map_sync /home/n0psledbyte/radare2/libr/debug/map.c:297
    #4 0x7f0b325fac47 in validAddress /home/n0psledbyte/radare2/libr/core/cmd_debug.c:2672
    #5 0x7f0b326022aa in r_core_cmd_bp /home/n0psledbyte/radare2/libr/core/cmd_debug.c:3408
    #6 0x7f0b3260ba3c in cmd_debug /home/n0psledbyte/radare2/libr/core/cmd_debug.c:4641
    #7 0x7f0b32790910 in r_cmd_call /home/n0psledbyte/radare2/libr/core/cmd_api.c:237
    #8 0x7f0b326f2880 in r_core_cmd_subst_i /home/n0psledbyte/radare2/libr/core/cmd.c:2876
    #9 0x7f0b326eba78 in r_core_cmd_subst /home/n0psledbyte/radare2/libr/core/cmd.c:1905
    #10 0x7f0b326f7ce7 in r_core_cmd /home/n0psledbyte/radare2/libr/core/cmd.c:3580
    #11 0x7f0b325c4616 in r_core_prompt_exec /home/n0psledbyte/radare2/libr/core/core.c:2450
    #12 0x55f011af58cc in main /home/n0psledbyte/radare2/binr/radare2/radare2.c:1378
    #13 0x7f0b2c9bd82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)

Indirect leak of 208 byte(s) in 7 object(s) allocated from:
    #0 0x7f0b32c7730f in strdup (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x6230f)
    #1 0x7f0b312d5c47 in r_debug_gdb_map_get p/debug_gdb.c:219
    #2 0x7f0b312b63d6 in r_debug_map_sync /home/n0psledbyte/radare2/libr/debug/map.c:297
    #3 0x7f0b325fac47 in validAddress /home/n0psledbyte/radare2/libr/core/cmd_debug.c:2672
    #4 0x7f0b326022aa in r_core_cmd_bp /home/n0psledbyte/radare2/libr/core/cmd_debug.c:3408
    #5 0x7f0b3260ba3c in cmd_debug /home/n0psledbyte/radare2/libr/core/cmd_debug.c:4641
    #6 0x7f0b32790910 in r_cmd_call /home/n0psledbyte/radare2/libr/core/cmd_api.c:237
    #7 0x7f0b326f2880 in r_core_cmd_subst_i /home/n0psledbyte/radare2/libr/core/cmd.c:2876
    #8 0x7f0b326eba78 in r_core_cmd_subst /home/n0psledbyte/radare2/libr/core/cmd.c:1905
    #9 0x7f0b326f7ce7 in r_core_cmd /home/n0psledbyte/radare2/libr/core/cmd.c:3580
    #10 0x7f0b325c4616 in r_core_prompt_exec /home/n0psledbyte/radare2/libr/core/core.c:2450
    #11 0x55f011af58cc in main /home/n0psledbyte/radare2/binr/radare2/radare2.c:1378
    #12 0x7f0b2c9bd82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)

Indirect leak of 208 byte(s) in 7 object(s) allocated from:
    #0 0x7f0b32c7730f in strdup (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x6230f)
    #1 0x7f0b312b60e4 in r_debug_map_new /home/n0psledbyte/radare2/libr/debug/map.c:280
    #2 0x7f0b312d5ba2 in r_debug_gdb_map_get p/debug_gdb.c:214
    #3 0x7f0b312b63d6 in r_debug_map_sync /home/n0psledbyte/radare2/libr/debug/map.c:297
    #4 0x7f0b312c2081 in r_debug_get_baddr /home/n0psledbyte/radare2/libr/debug/debug.c:1624
    #5 0x55f011af3114 in main /home/n0psledbyte/radare2/binr/radare2/radare2.c:973
    #6 0x7f0b2c9bd82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)

Indirect leak of 208 byte(s) in 7 object(s) allocated from:
    #0 0x7f0b32c7730f in strdup (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x6230f)
    #1 0x7f0b312b60e4 in r_debug_map_new /home/n0psledbyte/radare2/libr/debug/map.c:280
    #2 0x7f0b312d5ba2 in r_debug_gdb_map_get p/debug_gdb.c:214
    #3 0x7f0b312b63d6 in r_debug_map_sync /home/n0psledbyte/radare2/libr/debug/map.c:297
    #4 0x7f0b312b9bca in r_debug_bp_add /home/n0psledbyte/radare2/libr/debug/debug.c:302
    #5 0x7f0b3260231b in r_core_cmd_bp /home/n0psledbyte/radare2/libr/core/cmd_debug.c:3409
    #6 0x7f0b3260ba3c in cmd_debug /home/n0psledbyte/radare2/libr/core/cmd_debug.c:4641
    #7 0x7f0b32790910 in r_cmd_call /home/n0psledbyte/radare2/libr/core/cmd_api.c:237
    #8 0x7f0b326f2880 in r_core_cmd_subst_i /home/n0psledbyte/radare2/libr/core/cmd.c:2876
    #9 0x7f0b326eba78 in r_core_cmd_subst /home/n0psledbyte/radare2/libr/core/cmd.c:1905
    #10 0x7f0b326f7ce7 in r_core_cmd /home/n0psledbyte/radare2/libr/core/cmd.c:3580
    #11 0x7f0b325c4616 in r_core_prompt_exec /home/n0psledbyte/radare2/libr/core/core.c:2450
    #12 0x55f011af58cc in main /home/n0psledbyte/radare2/binr/radare2/radare2.c:1378
    #13 0x7f0b2c9bd82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)

Indirect leak of 208 byte(s) in 7 object(s) allocated from:
    #0 0x7f0b32c7730f in strdup (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x6230f)
    #1 0x7f0b312d5c47 in r_debug_gdb_map_get p/debug_gdb.c:219
    #2 0x7f0b312b63d6 in r_debug_map_sync /home/n0psledbyte/radare2/libr/debug/map.c:297
    #3 0x7f0b312b9bca in r_debug_bp_add /home/n0psledbyte/radare2/libr/debug/debug.c:302
    #4 0x7f0b3260231b in r_core_cmd_bp /home/n0psledbyte/radare2/libr/core/cmd_debug.c:3409
    #5 0x7f0b3260ba3c in cmd_debug /home/n0psledbyte/radare2/libr/core/cmd_debug.c:4641
    #6 0x7f0b32790910 in r_cmd_call /home/n0psledbyte/radare2/libr/core/cmd_api.c:237
    #7 0x7f0b326f2880 in r_core_cmd_subst_i /home/n0psledbyte/radare2/libr/core/cmd.c:2876
    #8 0x7f0b326eba78 in r_core_cmd_subst /home/n0psledbyte/radare2/libr/core/cmd.c:1905
    #9 0x7f0b326f7ce7 in r_core_cmd /home/n0psledbyte/radare2/libr/core/cmd.c:3580
    #10 0x7f0b325c4616 in r_core_prompt_exec /home/n0psledbyte/radare2/libr/core/core.c:2450
    #11 0x55f011af58cc in main /home/n0psledbyte/radare2/binr/radare2/radare2.c:1378
    #12 0x7f0b2c9bd82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)

Indirect leak of 208 byte(s) in 7 object(s) allocated from:
    #0 0x7f0b32c7730f in strdup (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x6230f)
    #1 0x7f0b312d5c47 in r_debug_gdb_map_get p/debug_gdb.c:219
    #2 0x7f0b312b63d6 in r_debug_map_sync /home/n0psledbyte/radare2/libr/debug/map.c:297
    #3 0x7f0b312c2081 in r_debug_get_baddr /home/n0psledbyte/radare2/libr/debug/debug.c:1624
    #4 0x55f011af3114 in main /home/n0psledbyte/radare2/binr/radare2/radare2.c:973
    #5 0x7f0b2c9bd82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)

SUMMARY: AddressSanitizer: 8810 byte(s) leaked in 111 allocation(s).

i got a backtrace from generated coredump that is not clear.

pi@raspberrypi:~ $ gdb --core=core -q
[New LWP 522]
Core was generated by `gdbserver :5000 ./path/to/bin'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0xb6e33b6c in ?? ()
(gdb) bt
#0  0xb6e33b6c in ?? ()
#1  0x00038594 in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
(gdb)

@radare
Copy link
Collaborator

radare commented Jul 25, 2018 via email

@d4em0n
Copy link
Contributor Author

d4em0n commented Jul 25, 2018

Yeah like i said before, using gdb-multiarch as gdb client it's works fine.

@XVilka
Copy link
Contributor

XVilka commented Jul 25, 2018

Technically it is radare2 bug, because it doesn't make packets properly for gdbserver to understand. On the other hand GDB Remote protocol is a mess and many things are not even compatible between different GDB server implementations.

@d4em0n
Copy link
Contributor Author

d4em0n commented Jul 25, 2018

This is a breakpoint kind problem, radare2 set breakpoint kind to 1 it should depends on architecture. i sent a PR
https://sourceware.org/gdb/onlinedocs/gdb/Packets.html

@radare radare closed this as completed in 3524f8b Jul 31, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gdb Remote GDB protocol support RDebug
Projects
None yet
Development

No branches or pull requests

3 participants