elfmaster / binflow

This is the new ftrace (https://github.com/elfmaster/ftrace) - Much faster, better resolution but not complete yet! :)
106 stars 31 forks source link

segfault on startup #5

Open Silur opened 7 years ago

Silur commented 7 years ago

No matter whether tracing with -b or -p, binflow always crashes with a segfault. trace:

Stack trace of thread 20472:
                                              #0  0x000000000040375f n/a (binflow)
                                              #1  0x0000000000403ee0 n/a (binflow)
                                              #2  0x0000000000402f7a n/a (binflow)
                                              #3  0x00007fc9b65ea291 __libc_start_main (libc.so.6)
                                              #4  0x0000000000402949 n/a (binflow)

Runing on Arch linux x86_64 4.8.13-1

Silur commented 7 years ago

cause seems like to be this line, I'll try to resolve it and make a PR: elf.c:97 h->dsyms[h->dsc].name = xstrdup(&SymStrTable[symtab->st_name]);

Silur commented 7 years ago

Okay, got the problem, binflow.h:39 #define MAX_SYMS 8192 * 2, my executable has more symbols than this and there is no proper error handling for that. Definitely have to change handle->dsyms to a pointer to allow dynamic accommodation.