Project Home
Project Home
Trackers
Trackers
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
BroadcastCommunity.qnx.com will be offline from May 31 6:00pm until June 2 12:00AM for upcoming system upgrades. For more information please go to https://community.qnx.com/sf/discussion/do/listPosts/projects.bazaar/discussion.bazaar.topc28418
Forum Topic - malloc causes segfault/SIGSEGV: Page 1 of 13 (13 Items)
   
malloc causes segfault/SIGSEGV  
I'm using C++ in QNX 6.3.2 and I got a segmentation fault while I was calling "put" on a ostream. The ostream, 
internally called malloc and it cause the segfault.

Here is the backtrace from the core file:

(gdb) bt
#0  0xb031ee55 in _block_mem_malloc_align () from /usr/qnx632/target/qnx6/x86/lib/libc.so.2
#1  0xb031ef6d in _band_get_aligned () from /usr/qnx632/target/qnx6/x86/lib/libc.so.2
#2  0xb031f01b in _band_get () from /usr/qnx632/target/qnx6/x86/lib/libc.so.2
#3  0xb03210ec in __malloc_lock () from /usr/qnx632/target/qnx6/x86/lib/libc.so.2
#4  0xb03211c8 in __malloc () from /usr/qnx632/target/qnx6/x86/lib/libc.so.2
#5  0xb031ea72 in malloc () from /usr/qnx632/target/qnx6/x86/lib/libc.so.2
#6  0xb851abef in __builtin_new () from /usr/qnx632/target/qnx6/x86/lib/libcpp.so.3
#7  0xb851a9f3 in __builtin_vec_new () from /usr/qnx632/target/qnx6/x86/lib/libcpp.so.3
#8  0x080556a3 in stringbuf::overflow (this=0x7e5bf04, c=0) at /opt/qnx632/target/qnx6/usr/include/g++-3/sstream:110
#9  0xb823951d in __overflow () at ../../../../libstdc++/std/std_valarray.h:268
#10 0xb823dbdc in _IO_putc () at ../../../../libstdc++/std/std_valarray.h:268
#11 0xb8253d30 in ostream::put (this=0x7e5bf00, c=0) at ../../../../libio/streambuf.h:395
#12 0x0806a8a3 in operator<< (os=@0x7e5bf00, tag=@0x809f570) at rftag-analog.cc:44
#13 0x080636e9 in operator<< (os=@0x7e5bf00, grp=@0x80c79b8) at ielgroup.cc:321
#14 0x0806e0b9 in IElcomConnection::handlePeriodicGroup (this=0x80be0a0) at ielcomconnection.cc:558
#15 0x0806de6a in IElcomConnection::thread_handlePeriodicGroup (arg=0x80be0a0) at ielcomconnection.cc:524


Until #12 is what my program does, after that all is inside the call to "put" of the ostream (os is a ostream).

From the back trace it seems clear that what is causing the segfault is inside the malloc, so it should be a bug in 
QNX's libc, if I'm not missing something.


Just in case it matters, besides Apache, php, ssh and RealFlex (with Ls900 driver) its a plain/default QNX 6.3.2 run-
time installation on x86. And this program (the one I pasted the back trace) is multi-thread, and this is the thread it 

causes the segfault.


Also, I don't know how to reproduce it, it happened only once in almost 8 months.


Does this happen to anyone (segfault in malloc) ? It's a known bug or can I report it somewhere else ? Does anyone know 

if 6.3 is maintained yet and I can expect a new release fixing this ?




Thanks a lot,
Rodrigo