#89bae80 buffer overflow detected in emu_devo10

More
01 Jan 2013 20:59 - 01 Jan 2013 21:01 #4484 by domcars0
Hi,
I've just compiled the #89bae80 PB commit to try the new 'standard' mixers in the emulator.
But I'm unable to enter this mixer mode, cause when I try it (via the file template or via the model config), the emulator crash with a "buffer overflow detected"?

*** buffer overflow detected ***: ./emu_devo10.elf terminated
======= Backtrace: =========
/lib/i386-linux-gnu/libc.so.6(__fortify_fail+0x45)[0x3cc045]
/lib/i386-linux-gnu/libc.so.6(+0x102e1a)[0x3cae1a/lib/i386-linux-gnu/libc.so.6(+0x102478)[0x3ca478]
/lib/i386-linux-gnu/libc.so.6(_IO_default_xsputn+0x91)[0x33b501]
/lib/i386-linux-gnu/libc.so.6(_IO_vfprintf+0x2352)[0x30ce02]
/lib/i386-linux-gnu/libc.so.6(__vsprintf_chk+0xc9)[0x3ca549]
/lib/i386-linux-gnu/libc.so.6(__sprintf_chk+0x2f)[0x./emu_devo10.elf[0x807687c]
./emu_devo10.elf[0x8076980]
./emu_devo10.elf[0x805ad4f]
./emu_devo10.elf[0x8054943]
./emu_devo10.elf[0x804a844]
./emu_devo10.elf[0x804a935]
./emu_devo10.elf[0x804b4d5]
./emu_devo10.elf[0x80498e8]
/lib/i386-linux-gnu/libc.so.6(__libc_start_main+0xf3)[0x2e14d3]
./emu_devo10.elf[0x804990d]

(followed by the memory map)

Compiled under Ubuntu 12.04-1, and there is just two warning during compilation:

...
+ Compiling 'inputs.c'
inputs.c: In function ‘INPUT_MapSourceName’:
inputs.c:95:9: attention : unused variable ‘i’ [-Wunused-variable]
inputs.c:93:36: attention : unused parameter ‘idx’ [-Wunused-parameter]
inputs.c:93:45: attention : unused parameter ‘val’ [-Wunused-parameter]
...
...
+ Compiling 'screen/lcd_string.c'
screen/lcd_string.c: In function ‘char_offset’:
screen/lcd_string.c:124:10: attention : ignoring return value of ‘fread’, declared with attribute warn_unused_result [-Wunused-result]
screen/lcd_string.c: In function ‘get_char_range’:
screen/lcd_string.c:103:10: attention : ignoring return value of ‘fread’, declared with attribute warn_unused_result [-Wunused-result]

Thanks for any help...
PS: Same issue with the emu_devo8

Devo 10 (+7e) owner. It's mine, please don't touch it with your big fingers :angry:
Last edit: 01 Jan 2013 21:01 by domcars0.

Please Log in or Create an account to join the conversation.

More
01 Jan 2013 23:30 - 02 Jan 2013 00:18 #4488 by RugWarrior
Replied by RugWarrior on topic #89bae80 buffer overflow detected in emu_devo10
Hi.

If I compile the latest commits with my MinGW DeviationTX build environment and try the emu_devo8 I do not get an error?!

But I can see the compile warning for the devo10...

I do not know how to use the devo10 emu :P
Last edit: 02 Jan 2013 00:18 by RugWarrior.

Please Log in or Create an account to join the conversation.

More
02 Jan 2013 10:52 #4513 by domcars0
Hi,
I have to say that it works (no buffer overflow) when compiled on a RHEL6 (with fltk 1.1.10) ... probably an issue in my ubuntu libfltk (will see that this evening)..
Thanks

Devo 10 (+7e) owner. It's mine, please don't touch it with your big fingers :angry:

Please Log in or Create an account to join the conversation.

More
03 Jan 2013 00:12 - 03 Jan 2013 07:57 #4539 by domcars0
I do not understand, the libfltk on my Ubuntu 12.04 is the same as the one I have on my RHEL6 (libfltk 1.1.10)? Strange... :huh:

Devo 10 (+7e) owner. It's mine, please don't touch it with your big fingers :angry:
Last edit: 03 Jan 2013 07:57 by domcars0.

Please Log in or Create an account to join the conversation.

More
03 Jan 2013 00:55 #4541 by PhracturedBlue
Replied by PhracturedBlue on topic #89bae80 buffer overflow detected in emu_devo10
are you using a language other than english? if so which one? does it happen using only english as well?

Please Log in or Create an account to join the conversation.

More
03 Jan 2013 07:57 #4555 by domcars0
Hi PB,
This happens in any language (French, English, Spanish , German), on emu_devo10 as well as on emu_devo8...

Devo 10 (+7e) owner. It's mine, please don't touch it with your big fingers :angry:

Please Log in or Create an account to join the conversation.

More
03 Jan 2013 14:34 #4600 by PhracturedBlue
Replied by PhracturedBlue on topic #89bae80 buffer overflow detected in emu_devo10
try to run within gdb and see whta is going on.
make sure you are building with dbeug enabled:
make clean TARGET=emu_devo10; make TARGET=emu_devo10
now start up in gdb:
gdb ./emu_devo10.elf
at the prompt:
> r
try to make it crash
hopefully it locks up and you get a prompt back in gdb.
now:
> thread apply all bt full

send those results.

Please Log in or Create an account to join the conversation.

More
05 Jan 2013 22:38 #4716 by domcars0
Hi PB here is the result of the gdbn command after emu_devo10 crashed
(gdb) thread apply all bt full

... some infos about no debug symbols in system libs and...

#6  0x0807fd00 in CONFIG_ReadTemplate (filename=0x8082fe0 "heli_std.ini") at config/model.c:1178
        file = "template/heli_std.in"
#7  0x0805ad06 in invalid_simplemixer_cb (state=1 '\001', guiObj=0x8090f58) at pages/128x64x1/../common/_dialogs.c:62
No locals.
#8  0x080531b8 in DialogClose (obj=0x8091060, state=1 '\001') at gui/dialog.c:123
        dialog = 0x8091074
        data = 0x8090f58
        func = 0x805acab <invalid_simplemixer_cb>
#9  0x080531d9 in dlgbut_pressok_cb (obj=0x80910b8, data=0x8091060) at gui/dialog.c:129
        dlgObj = 0x8091060
#10 0x080545b1 in GUI_TouchRelease () at gui/gui.c:320
        button = 0x80910cc
#11 0x08053ab0 in _handle_modalbuttons_devo10 (button=65536, flags=1 '\001', data=0x0) at gui/128x64x1/_gui.c:197
No locals.
#12 0x0804a6ab in exec_callbacks (buttons=65536, flags=BUTTON_PRESS) at buttons.c:137
        ptr = 0x8092bf4
#13 0x0804a56b in BUTTON_Handler () at buttons.c:97
        last_buttons = 0
        last_buttons_pressed = 16384
        long_press_at = 215637560
        longpress_release = 0 '\000'
        buttons = 65536
        buttons_pressed = 65536
        buttons_released = 0
#14 0x0804b349 in EventLoop () at main.c:173
No locals.
#15 0x0804b18d in main () at main.c:87
        buttons = 0
(gdb) 

Devo 10 (+7e) owner. It's mine, please don't touch it with your big fingers :angry:

Please Log in or Create an account to join the conversation.

More
06 Jan 2013 03:40 #4717 by PhracturedBlue
Replied by PhracturedBlue on topic #89bae80 buffer overflow detected in emu_devo10
Unfortunately, that looks like stack corruption.
line 1178 in model.c is the end of the funtion and makes no sense as a crash point.

you could try the following:
after starting gdb, but before hitting 'r'
b CONFIG_ReadTemplate

Now try to switch to the standard interface. gdb should break at the beginning of the ReadTemplate function. you can now use 'n' to step through the function one line at a time and see if it crashes somewhere different.

Alternative:
install valgrind and try running:
valgrind ./emu_devo10.elf

and see if it shows something different. I've had very poor luck debugging with valgrind on Deviation though, so don' hold your breath.

FYI, I have no issues on 64-bit Ubuntu 12.04. If yours is 64-bit, you can send me your .elf file, and I can try it locally.

Please Log in or Create an account to join the conversation.

More
06 Jan 2013 03:46 #4718 by PhracturedBlue
Replied by PhracturedBlue on topic #89bae80 buffer overflow detected in emu_devo10
One other thing.
try 'hg status' and ensure you have no modified files and no extra ('?' files)

Please Log in or Create an account to join the conversation.

More
06 Jan 2013 09:46 #4725 by domcars0

PhracturedBlue wrote: Unfortunately, that looks like stack corruption.
line 1178 in model.c is the end of the funtion and makes no sense as a crash point.

you could try the following:
after starting gdb, but before hitting 'r'
b CONFIG_ReadTemplate

Now try to switch to the standard interface. gdb should break at the beginning of the ReadTemplate function. you can now use 'n' to step through the function one line at a time and see if it crashes somewhere different.


and see if it shows something different. I've had very poor luck debugging with valgrind on Deviation though, so don' hold your breath.

Here is the result....
Breakpoint 1, CONFIG_ReadTemplate (filename=0x8082ee0 "heli_std.ini")
    at config/model.c:1164
1164	u8 CONFIG_ReadTemplate(const char *filename) {
(gdb) n
1167	    sprintf(file, "template/%s", filename);
(gdb) n
1168	    clear_model(0);
(gdb) n
1169	    auto_map = 0;
(gdb) n
1170	    if (CONFIG_IniParse(file, ini_handler, &Model)) {
(gdb) n
1174	    if(auto_map)
(gdb) n
1176	    MIXER_RegisterTrimButtons();
(gdb) n
1177	    return 1;
(gdb) n
1178	}
(gdb) n
*** stack smashing detected ***: 
Program received signal SIGABRT, Aborted.
0x00132416 in __kernel_vsyscall ()
(gdb)

PhracturedBlue wrote: FYI, I have no issues on 64-bit Ubuntu 12.04. If yours is 64-bit, you can send me your .elf file, and I can try it locally.

UNfortunatly mine is a 32-bit :(
Thanks

Devo 10 (+7e) owner. It's mine, please don't touch it with your big fingers :angry:

Please Log in or Create an account to join the conversation.

More
06 Jan 2013 10:05 #4726 by domcars0

PhracturedBlue wrote: One other thing.
try 'hg status' and ensure you have no modified files and no extra ('?' files)


domcars0@mars:~/deviationdevo10$ hg status
domcars0@mars:~/deviationdevo10$
:(

Devo 10 (+7e) owner. It's mine, please don't touch it with your big fingers :angry:

Please Log in or Create an account to join the conversation.

More
23 Feb 2013 18:13 - 23 Feb 2013 18:14 #6901 by domcars0
As since some release the error became:
**** stack smashing detected ***
I found on the web how to turn of this gcc feature ( Stack Smashing ), by
compiling with -fno-stack-protector

So I've just changed the main Makefile to :

CFLAGS := $(CFLAGS) -Wall -Wextra -I. -D$(PROGMODE) -fno-stack-protector -std=gnu99 -Itarget/$(TARGET) -Igui/$(SCREENSIZE) -DHGVERSION="\"${HGVERSION}\""

And now I can switch in <Standard>Mixer GUI on my Ubuntu!!
Probably not very secure but it works...

Devo 10 (+7e) owner. It's mine, please don't touch it with your big fingers :angry:
Last edit: 23 Feb 2013 18:14 by domcars0.

Please Log in or Create an account to join the conversation.

Time to create page: 0.048 seconds
Powered by Kunena Forum