bugGNU Octave - Bugs: bug #46449, Address-sanitizer triggered in...

 
 

bug #46449: Address-sanitizer triggered in scripts/sparse/ichol.m

Submitter:  Robert Jenssen <morgawr>
Submitted:  Sun 15 Nov 2015 09:34:47 AM UTC
   
 
Category:  Interpreter Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Segfault, Bus Error, etc.
Status:  Fixed Assigned to:  siko1056
Originator Name:  Robert Jenssen Open/Closed:  * Closed
Release:  * dev Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Wed 09 Mar 2016 05:58:51 PM UTC, comment #14: 

This was real.  For any sparse matrices that had columns of all zeros to the right of the last non-zero element the code was overstepping the ridx pointer array.  This bug was in ichol as well as ilu (written by the same person so not surprising).  I fixed that in this cset (http://hg.savannah.gnu.org/hgweb/octave/rev/13415264b9f8).

In order to test with the address sanitizer I had to compile using '--without-opengl' and '--disable-docs' because there are all kinds of problems associated with OpenGl.  That should probably be a separate bug report.

Rik <rik5>
Group administrator
Fri 20 Nov 2015 08:22:19 AM UTC, comment #13: 

I'll have a look at it.

Kai Torben Ohlhus <siko1056>
Group Member
Thu 19 Nov 2015 03:08:18 PM UTC, comment #12: 

Also


ichol (sparse ([1, 0; 0, 0]))


So, structurally singular matrices are not handled properly by this algorithm.  I'm not sure how to fix that.

Kai, I'm adding you to this report.  Can you help to fix this problem?

John W. Eaton <jwe>
Group administrator
Thu 19 Nov 2015 02:54:17 PM UTC, comment #11: 

It seems that


ichol (sparse (0))


will trigger the bug.

John W. Eaton <jwe>
Group administrator
Thu 19 Nov 2015 02:41:35 PM UTC, comment #10: 

If I use --disable-opengl, then building and running make check succeeds and I get to the ichol problem.

John W. Eaton <jwe>
Group administrator
Thu 19 Nov 2015 06:02:27 AM UTC, comment #9: 

Some anecdotal evidence in response to JWE's comment about OpenGL:

1. I find that when using the stock Fedora 23 build of octave-4.0.0 I get different numerical output from the same script run repeatedly. When I use an octave that I have built without native graphics I don't see this. (Where my octave uses the numerical libraries supplied by the Fedora 23 installation).

2. I have been trying to track down a similar problem with the SeDuMi_1_3 solver running under an octave built without native graphics. I think that maybe, possibly, I have solved this one by using address-sanitizer to find an error in which an array of doubles was read one location beyond the end (in cholonBlk()).

Robert Jenssen <morgawr>
Wed 18 Nov 2015 10:09:26 PM UTC, comment #8: 

This definitely looks like a useful tool.
I hope that people agree that releases have to build
and run make check cleanly.

Lots of thanks to Robert Jenssen for pointing this
out.

Michael Godfrey <godfrey>
Group Member
Wed 18 Nov 2015 09:00:25 PM UTC, comment #7: 

So, looking at that output, could some of our OpenGL crash issues be due to data in Octave functions being cleared and deleted when it is still in use in a separate thread?  Hmm.

John W. Eaton <jwe>
Group administrator
Wed 18 Nov 2015 08:56:47 PM UTC, comment #6: 

I checked in the following change:

http://hg.savannah.gnu.org/hgweb/octave/rev/4a25c398ffa2

With these options, I can't build Octave because it crashes for me when attempting to generate figures.

If I use disable-docs, then it builds, but make check fails when trying to test some graphics features.  The failure is happening in the OpenGL driver code.  Sweet.

Here is the output at the point when make check stops for me:


  libinterp/corefcn/graphics.cc-tst ...........................=================================================================
==6093==ERROR: AddressSanitizer: heap-use-after-free on address 0x604000067ff4 at pc 0x7f3c9d0cc3bd bp 0x7ffcbe4e3fe0 sp 0x7ffcbe4e3790
READ of size 1 at 0x604000067ff4 thread T0
    #0 0x7f3c9d0cc3bc  (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x463bc)
    #1 0x7f3c66e88fb4  (/usr/lib/x86_64-linux-gnu/dri/r600_dri.so+0x3cffb4)
    #2 0x7f3c8e773959  (/lib/x86_64-linux-gnu/libexpat.so.1+0xa959)
    #3 0x7f3c8e77466b  (/lib/x86_64-linux-gnu/libexpat.so.1+0xb66b)
    #4 0x7f3c8e7729b8  (/lib/x86_64-linux-gnu/libexpat.so.1+0x99b8)
    #5 0x7f3c8e773134  (/lib/x86_64-linux-gnu/libexpat.so.1+0xa134)
    #6 0x7f3c8e7766cf in XML_ParseBuffer (/lib/x86_64-linux-gnu/libexpat.so.1+0xd6cf)
    #7 0x7f3c66e895a4  (/usr/lib/x86_64-linux-gnu/dri/r600_dri.so+0x3d05a4)
    #8 0x7f3c66d6e23c  (/usr/lib/x86_64-linux-gnu/dri/r600_dri.so+0x2b523c)
    #9 0x7f3c66d6ff4c  (/usr/lib/x86_64-linux-gnu/dri/r600_dri.so+0x2b6f4c)
    #10 0x7f3c66d6c932  (/usr/lib/x86_64-linux-gnu/dri/r600_dri.so+0x2b3932)
    #11 0x7f3c94779532  (/usr/lib/x86_64-linux-gnu/libGL.so.1+0x45532)
    #12 0x7f3c94751803  (/usr/lib/x86_64-linux-gnu/libGL.so.1+0x1d803)
    #13 0x7f3c9474db8a  (/usr/lib/x86_64-linux-gnu/libGL.so.1+0x19b8a)
    #14 0x7f3c9474dced in glXChooseVisual (/usr/lib/x86_64-linux-gnu/libGL.so.1+0x19ced)
    #15 0x7f3c966992fe  (/usr/lib/x86_64-linux-gnu/libQtOpenGL.so.4+0xaa2fe)
    #16 0x7f3c9661f37f  (/usr/lib/x86_64-linux-gnu/libQtOpenGL.so.4+0x3037f)
    #17 0x7f3c966975ac in QGLContext::chooseVisual() (/usr/lib/x86_64-linux-gnu/libQtOpenGL.so.4+0xa85ac)
    #18 0x7f3c9669a8e3 in QGLContext::chooseContext(QGLContext const*) (/usr/lib/x86_64-linux-gnu/libQtOpenGL.so.4+0xab8e3)
    #19 0x7f3c9661dcac in QGLContext::create(QGLContext const*) (/usr/lib/x86_64-linux-gnu/libQtOpenGL.so.4+0x2ecac)
    #20 0x7f3c96699606 in QGLWidget::setContext(QGLContext*, QGLContext const*, bool) (/usr/lib/x86_64-linux-gnu/libQtOpenGL.so.4+0xaa606)
    #21 0x7f3c9661dad4  (/usr/lib/x86_64-linux-gnu/libQtOpenGL.so.4+0x2ead4)
    #22 0x7f3c966981df  (/usr/lib/x86_64-linux-gnu/libQtOpenGL.so.4+0xa91df)
    #23 0x7f3c9661d50d in QGLWidget::QGLWidget(QGLFormat const&, QWidget*, QGLWidget const*, QFlags<Qt::WindowType>) (/usr/lib/x86_64-linux-gnu/libQtOpenGL.so.4+0x2e50d)
    #24 0x7f3c9cc152ba in QtHandles::GLCanvas::GLCanvas(QWidget*, octave_handle const&) /home/jwe/src/octave/libgui/graphics/GLCanvas.cc:45
    #25 0x7f3c9cc000e8 in QtHandles::Canvas::create(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, QWidget*, octave_handle const&) /home/jwe/src/octave/libgui/graphics/Canvas.cc:1014
    #26 0x7f3c9cc039f4 in QtHandles::Container::canvas(octave_handle const&, bool) /home/jwe/src/octave/libgui/graphics/Container.cc:62
    #27 0x7f3c9cc10932 in QtHandles::Figure::enableMouseTracking() /home/jwe/src/octave/libgui/graphics/Figure.cc:985
    #28 0x7f3c9cc096f8 in QtHandles::Figure::Figure(graphics_object const&, QtHandles::FigureWindow*) /home/jwe/src/octave/libgui/graphics/Figure.cc:167
    #29 0x7f3c9cc08c8c in QtHandles::Figure::create(graphics_object const&) /home/jwe/src/octave/libgui/graphics/Figure.cc:123
    #30 0x7f3c9cc224db in QtHandles::ObjectFactory::createObject(double) /home/jwe/src/octave/libgui/graphics/ObjectFactory.cc:97
    #31 0x7f3c9cbd7dc7 in QtHandles::ObjectFactory::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) libgui/graphics/moc-ObjectFactory.cc:52
    #32 0x7f3c955aff60 in QObject::event(QEvent*) (/usr/lib/x86_64-linux-gnu/libQtCore.so.4+0x1a4f60)
    #33 0x7f3c95ac28db in QApplicationPrivate::notify_helper(QObject*, QEvent*) (/usr/lib/x86_64-linux-gnu/libQtGui.so.4+0x1c48db)
    #34 0x7f3c95ac9815 in QApplication::notify(QObject*, QEvent*) (/usr/lib/x86_64-linux-gnu/libQtGui.so.4+0x1cb815)
    #35 0x7f3c95595abc in QCoreApplication::notifyInternal(QObject*, QEvent*) (/usr/lib/x86_64-linux-gnu/libQtCore.so.4+0x18aabc)
    #36 0x7f3c95599575 in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) (/usr/lib/x86_64-linux-gnu/libQtCore.so.4+0x18e575)
    #37 0x7f3c955c6292  (/usr/lib/x86_64-linux-gnu/libQtCore.so.4+0x1bb292)
    #38 0x7f3c8f694fe6 in g_main_context_dispatch (/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x49fe6)
    #39 0x7f3c8f69523f  (/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x4a23f)
    #40 0x7f3c8f6952eb in g_main_context_iteration (/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x4a2eb)
    #41 0x7f3c955c63e3 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) (/usr/lib/x86_64-linux-gnu/libQtCore.so.4+0x1bb3e3)
    #42 0x7f3c95b6ca35  (/usr/lib/x86_64-linux-gnu/libQtGui.so.4+0x26ea35)
    #43 0x7f3c95594330 in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) (/usr/lib/x86_64-linux-gnu/libQtCore.so.4+0x189330)
    #44 0x7f3c955946a4 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) (/usr/lib/x86_64-linux-gnu/libQtCore.so.4+0x1896a4)
    #45 0x7f3c9559a688 in QCoreApplication::exec() (/usr/lib/x86_64-linux-gnu/libQtCore.so.4+0x18f688)
    #46 0x7f3c9cb368be in octave_start_gui(int, char**, bool) /home/jwe/src/octave/libgui/src/octave-gui.cc:201
    #47 0x402a91 in main /home/jwe/src/octave/src/main-gui.cc:43
    #48 0x7f3c96e6bb44 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b44)
    #49 0x402978  (/scratch/jwe/build/octave/src/.libs/lt-octave-gui+0x402978)

0x604000067ff4 is located 36 bytes inside of 46-byte region [0x604000067fd0,0x604000067ffe)
freed by thread T1 (QThread) here:
    #0 0x7f3c9d11b62a in operator delete(void*) (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x9562a)
    #1 0x7f3c9bb59ac6 in out_of_date_check(octave_value&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool) /home/jwe/src/octave/libinterp/corefcn/symtab.cc:223
    #2 0x7f3c9bb5dfa9 in symbol_table::fcn_info::fcn_info_rep::find_user_function() /home/jwe/src/octave/libinterp/corefcn/symtab.cc:1077
    #3 0x7f3c9bb5a648 in symbol_table::fcn_info::fcn_info_rep::load_class_constructor() /home/jwe/src/octave/libinterp/corefcn/symtab.cc:448
    #4 0x7f3c9bb5c6e0 in symbol_table::fcn_info::fcn_info_rep::xfind(octave_value_list const&, bool) /home/jwe/src/octave/libinterp/corefcn/symtab.cc:798
    #5 0x7f3c9bb5c021 in symbol_table::fcn_info::fcn_info_rep::find(octave_value_list const&, bool) /home/jwe/src/octave/libinterp/corefcn/symtab.cc:697
    #6 0x7f3c9bb6426a in symbol_table::fcn_info::find(octave_value_list const&, bool) /home/jwe/src/octave/libinterp/corefcn/symtab.h:1022
    #7 0x7f3c9bb58a76 in symbol_table::symbol_record::find(octave_value_list const&) const /home/jwe/src/octave/libinterp/corefcn/symtab.cc:140
    #8 0x7f3c9b582d7f in tree_identifier::do_lookup(octave_value_list const&) /home/jwe/src/octave/libinterp/parse-tree/pt-id.h:91
    #9 0x7f3c9b57fdef in tree_index_expression::rvalue(int, std::__cxx11::list<octave_lvalue, std::allocator<octave_lvalue> > const*) /home/jwe/src/octave/libinterp/parse-tree/pt-idx.cc:316
    #10 0x7f3c9b57f542 in tree_index_expression::rvalue(int) /home/jwe/src/octave/libinterp/parse-tree/pt-idx.cc:269
    #11 0x7f3c9b580f63 in tree_index_expression::rvalue1(int) /home/jwe/src/octave/libinterp/parse-tree/pt-idx.cc:461
    #12 0x7f3c9b574b74 in tree_evaluator::visit_statement(tree_statement&) /home/jwe/src/octave/libinterp/parse-tree/pt-eval.cc:716
    #13 0x7f3c9b5ae15e in tree_statement::accept(tree_walker&) /home/jwe/src/octave/libinterp/parse-tree/pt-stmt.cc:178
    #14 0x7f3c9b574ee8 in tree_evaluator::visit_statement_list(tree_statement_list&) /home/jwe/src/octave/libinterp/parse-tree/pt-eval.cc:756
    #15 0x7f3c9b5af03a in tree_statement_list::accept(tree_walker&) /home/jwe/src/octave/libinterp/parse-tree/pt-stmt.cc:291
    #16 0x7f3c9b4adb2f in octave_user_function::do_multi_index_op(int, octave_value_list const&, std::__cxx11::list<octave_lvalue, std::allocator<octave_lvalue> > const*) /home/jwe/src/octave/libinterp/octave-value/ov-usr-fcn.cc:612
    #17 0x7f3c9b4acb52 in octave_user_function::subsref(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::list<octave_value_list, std::allocator<octave_value_list> > const&, int, std::__cxx11::list<octave_lvalue, std::allocator<octave_lvalue> > const*) /home/jwe/src/octave/libinterp/octave-value/ov-usr-fcn.cc:435
    #18 0x7f3c9b4bf881 in octave_value::subsref(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::list<octave_value_list, std::allocator<octave_value_list> > const&, int, std::__cxx11::list<octave_lvalue, std::allocator<octave_lvalue> > const*) /home/jwe/src/octave/libinterp/octave-value/ov.cc:1311
    #19 0x7f3c9b5807a4 in tree_index_expression::rvalue(int, std::__cxx11::list<octave_lvalue, std::allocator<octave_lvalue> > const*) /home/jwe/src/octave/libinterp/parse-tree/pt-idx.cc:428
    #20 0x7f3c9b55aec6 in tree_multi_assignment::rvalue(int) /home/jwe/src/octave/libinterp/parse-tree/pt-assign.cc:222
    #21 0x7f3c9b5ddf0b in eval_string(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool, int&, int) libinterp/parse-tree/oct-parse.yy:4844
    #22 0x7f3c9b5de1de in eval_string libinterp/parse-tree/oct-parse.yy:4890
    #23 0x7f3c9b5de34f in Feval(octave_value_list const&, int) libinterp/parse-tree/oct-parse.yy:4964
    #24 0x7f3c9b34374f in octave_builtin::do_multi_index_op(int, octave_value_list const&, std::__cxx11::list<octave_lvalue, std::allocator<octave_lvalue> > const*) /home/jwe/src/octave/libinterp/octave-value/ov-builtin.cc:126
    #25 0x7f3c9b3432a8 in octave_builtin::subsref(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::list<octave_value_list, std::allocator<octave_value_list> > const&, int, std::__cxx11::list<octave_lvalue, std::allocator<octave_lvalue> > const*) /home/jwe/src/octave/libinterp/octave-value/ov-builtin.cc:63
    #26 0x7f3c9b3430a5 in octave_builtin::subsref(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::list<octave_value_list, std::allocator<octave_value_list> > const&, int) /home/jwe/src/octave/libinterp/octave-value/ov-builtin.cc:46
    #27 0x7f3c9b4bf799 in octave_value::subsref(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::list<octave_value_list, std::allocator<octave_value_list> > const&, int) /home/jwe/src/octave/libinterp/octave-value/ov.cc:1302
    #28 0x7f3c9b4bf8a1 in octave_value::subsref(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::list<octave_value_list, std::allocator<octave_value_list> > const&, int, std::__cxx11::list<octave_lvalue, std::allocator<octave_lvalue> > const*) /home/jwe/src/octave/libinterp/octave-value/ov.cc:1313
    #29 0x7f3c9b5807a4 in tree_index_expression::rvalue(int, std::__cxx11::list<octave_lvalue, std::allocator<octave_lvalue> > const*) /home/jwe/src/octave/libinterp/parse-tree/pt-idx.cc:428

previously allocated by thread T1 (QThread) here:
    #0 0x7f3c9d11b0ea in operator new(unsigned long) (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x950ea)
    #1 0x7f3c97c64706 in void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char*>(char*, char*, std::forward_iterator_tag) (/usr/lib/x86_64-linux-gnu/libstdc++.so.6+0x11b706)
    #2 0x60b00164422f  (<unknown module>)
    #3 0x7f3c785076ff  (<unknown module>)

Thread T1 (QThread) created by T0 here:
    #0 0x7f3c9d0bc3d4 in pthread_create (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x363d4)
    #1 0x7f3c95485469 in QThread::start(QThread::Priority) (/usr/lib/x86_64-linux-gnu/libQtCore.so.4+0x7a469)

SUMMARY: AddressSanitizer: heap-use-after-free ??:0 ??
Shadow bytes around the buggy address:
  0x0c0880004fa0: fa fa 00 00 00 00 00 fa fa fa 00 00 00 00 00 00
  0x0c0880004fb0: fa fa 00 00 00 00 00 00 fa fa 00 00 00 00 00 00
  0x0c0880004fc0: fa fa 00 00 00 00 00 fa fa fa 00 00 00 00 00 fa
  0x0c0880004fd0: fa fa fd fd fd fd fd fd fa fa fd fd fd fd fd fa
  0x0c0880004fe0: fa fa fa fa fa fa fa fa fa fa fd fd fd fd fd fa
=>0x0c0880004ff0: fa fa fd fd fd fd fd fa fa fa fd fd fd fd[fd]fd
  0x0c0880005000: fa fa fd fd fd fd fd fa fa fa fd fd fd fd fd fa
  0x0c0880005010: fa fa fd fd fd fd fd fa fa fa fd fd fd fd fd fa
  0x0c0880005020: fa fa fd fd fd fd fd fa fa fa fd fd fd fd fd fa
  0x0c0880005030: fa fa fd fd fd fd fd fa fa fa fd fd fd fd fd fa
  0x0c0880005040: fa fa fd fd fd fd fd fa fa fa fd fd fd fd fd fa
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07
  Heap left redzone:       fa
  Heap right redzone:      fb
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack partial redzone:   f4
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
==6093==ABORTING

=================================================================
==5960==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 112 byte(s) in 1 object(s) allocated from:
    #0 0x7f039c45023a in operator new[](unsigned long) (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x9523a)
    #1 0x404c15 in main src/main.cc:447
    #2 0x7f039ae1cb44 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b44)

Indirect leak of 38 byte(s) in 1 object(s) allocated from:
    #0 0x7f039c45023a in operator new[](unsigned long) (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x9523a)
    #1 0x404a98 in strsave src/main.cc:420
    #2 0x405190 in main src/main.cc:518
    #3 0x7f039ae1cb44 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b44)

SUMMARY: AddressSanitizer: 150 byte(s) leaked in 2 allocation(s).
Makefile:28278: recipe for target 'check-local' failed
make[3]: *** [check-local] Error 23
make[3]: Leaving directory '/scratch/jwe/build/octave'
Makefile:26136: recipe for target 'check-am' failed
make[2]: *** [check-am] Error 2
make[2]: Leaving directory '/scratch/jwe/build/octave'
Makefile:25846: recipe for target 'check-recursive' failed
make[1]: *** [check-recursive] Error 1
make[1]: Leaving directory '/scratch/jwe/build/octave'
Makefile:26138: recipe for target 'check' failed
make: *** [check] Error 2


John W. Eaton <jwe>
Group administrator
Wed 18 Nov 2015 06:54:15 AM UTC, comment #5: 

Better is, in autoconf.ac:


### Add address-sanitizer checking
AC_MSG_CHECKING(for --with-address-sanitizer)
AC_ARG_WITH(address-sanitizer,
            AS_HELP_STRING([--with-address-sanitizer],
                           [add Address-Sanitizer checking]),
[
AC_MSG_RESULT($withval)
XTRA_CFLAGS="-g -fsanitize=address -fno-omit-frame-pointer $XTRA_CFLAGS"
XTRA_CXXFLAGS="-g -fsanitize=address -fno-omit-frame-pointer $XTRA_CXXFLAGS"
LDFLAGS="-g -fsanitize=address $LDFLAGS"
],
[AC_MSG_RESULT(no)])


Then running the following gives a stack trace with line numbers, attached.


ASAN_OPTIONS=symbolize=1 ASAN_SYMBOLIZER_PATH=llvm-symbolizer make check



(file #35486)

Robert Jenssen <morgawr>
Tue 17 Nov 2015 12:08:35 PM UTC, comment #4: 

The patch is OK except that we should not be directly altering CFLAGS, CXXFLAGS, FFLAGS, or LDFLAGS.  Those are supposed to be left to the user to define without having to worry about wiping out flags that are set by configure.  But Octave's build system already uses additional variables to handle this kind of thing, so the change should be fairly simple.  Unless someone beats me to it, I can make the changes.

John W. Eaton <jwe>
Group administrator
Tue 17 Nov 2015 09:26:56 AM UTC, comment #3: 

Robert: That should do it. The build system has
been worked on quite a bit lately, so one of the
folks who know that code should be able to apply
the patches.

Thanks again!

Michael Godfrey <godfrey>
Group Member
Tue 17 Nov 2015 08:08:27 AM UTC, comment #2: 

I know almost nothing about autoconf. I stole the following from:
 http://bugs.python.org/review/21037/patch/11412/42165


diff configure.ac configure.ac.old
229,241d228
< ### Add address-sanitizer checking
< AC_MSG_CHECKING(for --with-address-sanitizer)
< AC_ARG_WITH(address-sanitizer,
<             AS_HELP_STRING([--with-address-sanitizer],
<                            [add Address-Sanitizer checking]),
< [
< AC_MSG_RESULT($withval)
< CFLAGS="-fsanitize=address -fno-omit-frame-pointer $CFLAGS"
< CXXFLAGS="-fsanitize=address -fno-omit-frame-pointer $CXXFLAGS"
< LDFLAGS="-fsanitize=address $LDFLAGS"
< ],
< [AC_MSG_RESULT(no)])
<


I ran autoconf then configure with "--with-address-sanitizer". This causes all the conf tests to be compiled with
"-fsanitize=address" which may not be what the maintainers want. The resulting octave still fails "make check" at scripts/sparse/ichol.m as below.

Regarding my segfault problem: my test script copies the relevant files to a directory under /tmp, saves the expected results to a file, runs octave and compares the results with the saved file.
Surrounding octave with sync's works. Briefly:

cat > test.ok << 'EOF'
expected results
EOF
sync
octave-cli -q my_test.m >test.out
sync
diff test.ok test.out


Robert Jenssen <morgawr>
Mon 16 Nov 2015 11:55:01 PM UTC, comment #1: 

This is very useful. It suggests an item that should
be added to the release checklist:

All releases must be "address-sanitizer" clean for
make check, at least.

There should be a build option, like: --address-sanitize-on
which implements the script below.

I think that everyone would be very happy if you would
take an interest in producing a patch that implements this.

Michael Godfrey <godfrey>
Group Member
Sun 15 Nov 2015 09:34:47 AM UTC, original submission:  

I am running Fedora 23 with the packaged gcc-5.1.1-4 and octave-4.0.0. I have a project with a test suite of bash shell scripts, most of which run the octave interpreter and check the results. I have been getting seg-faults from octave. Usually, I would assume that this means that I have a hardware problem. I decided to check the octave interpreter with Address-Sanitizer. I built octave from the hg sources, as recommended in HACKING, with this shell script:

#!/bin/sh
uname -ro
hg clone http://hg.savannah.gnu.org/hgweb/octave/
cd octave
./bootstrap
mkdir .build
cd .build
CXXFLAGS="-fsanitize=address -fno-omit-frame-pointer"
export CXXFLAGS
CFLAGS="-fsanitize=address -fno-omit-frame-pointer"
export CFLAGS
LDFLAGS="-fsanitize=address"
export LDFLAGS
../configure --without-fltk --disable-gui --disable-java \
--enable-bounds-check --disable-docs
make LDFLAGS="-fsanitize=address" -j 6
make check

The "make check" ends when address-sanitizer finds a problem in scripts/sparse/ichol.m. The address-sanitizer stack trace is attached.

Robert Jenssen <morgawr>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #35464:  stack_trace.txt added by morgawr (45KiB - text/plain - Address sanitizer stack trace for failure in scripts/sparse/ichol.m)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by siko1056 (Posted a comment)
  • -email is unavailable- added by jwe
  • -email is unavailable- added by jwe (Posted a comment)
  • -email is unavailable- added by godfrey (Posted a comment)
  • -email is unavailable- added by morgawr (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2016-03-09 rik5 StatusNone Fixed
        Open/ClosedOpen Closed
    2016-02-26 siko1056 Assigned toNone siko1056
    2015-11-19 jwe Carbon-Copy- Added siko1056
    2015-11-18 morgawr Attached File- Added stack_trace_with_line_numbers.txt, #35486
    2015-11-15 morgawr Attached File- Added stack_trace.txt, #35464

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code