bugGNU Octave - Bugs: bug #52977, Octave can be caused to crash with...

 
 

bug #52977: Octave can be caused to crash with autoload'ed functions

Submitted by:  Olaf Till <i7tiol>
Submitted on:  Fri 26 Jan 2018 12:15:42 PM UTC  
 
Category:  Interpreter Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Segfault, Bus Error, etc.
Status:  Fixed Assigned to:  None
Originator Name:  Olaf Till Open/Closed:  Closed
Release:  dev Operating System:  GNU/Linux

Add a New Comment (Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Wed 11 Apr 2018 04:44:55 AM UTC, comment #3: 

Pushed to stable and merged to default:

http://hg.savannah.gnu.org/hgweb/octave/rev/cbe53b5ea5ce

John W. Eaton <jwe>
Project Administrator
Mon 09 Apr 2018 06:34:15 PM UTC, comment #2: 

It would be really nice to have this small patch (https://savannah.gnu.org/support/download.php?file_id=43190) applied to 4.3.0+

Without it the parallel package compiles, but does not install.

With it the package does install (verified with 4.3.0+ hg_id 27fe7e6aba31+)

A.R. Burgers <arb>
Tue 06 Feb 2018 06:10:45 AM UTC, comment #1: 

Same bug is triggered with

get_help_text ("somename")

if somename.oct is a file intended to be autoloaded with an alias.

This happens in installation of packages with such files, since Octaves builtin "__list_functions__" doesn't handle autoloads if called with a directory argument. (So that was triggers the bug is probably a bug itself. A different issue.)

The fix for the original bug (the segfault), enabling installation of such packages again, is checking if the loaded function is zero before using it. A small changeset is attached.

(file #43190)

Olaf Till <i7tiol>
Project Member
Fri 26 Jan 2018 12:15:42 PM UTC, original submission:  

Octave version (development branch):
c241918d4c92, 2018-01-19 08:09:21 -0800

Octave can be caused to crash with autoload'ed functions.

The same (?) thing, with identical upper 2 frames of the backtrace,
happened to me in installation of a package with autoload'ed
functions, causing me to construct this procedure to reproduce
(hopefully the same) bug without package installation.

Reproduce:

- for an arbitrary single DEFUN_DLD function "some_function" in file "test_interface.cc", build "test_interface.oct".
(for example this minimal function in file test_interface.cc:)

#include <octave/oct.h>

DEFUN_DLD (some_function, , , "")
{
  return octave_value_list ();
}

- from Octave commandline:

autoload ("some_function", "test_interface.oct")

- from Octave commandline, call:

some_function

- from an external shell commandline:

touch test_interface.oct

- from Octave commandline, call a 2nd time:

some_function

-> crash

(Hint: In the test case, this possibly happened because with the alias 'autoload ("name_1", "name_2.oct")' the file was re-loaded after increasing modification time, while ordinarily (without an alias, and the file beeing named 'some_function.oct') only a warning is displayed:

warning: library /home/olaf/devel/src/test/some_function.oct not reloaded due to existing references)

Program received signal SIGSEGV, Segmentation fault.
octave_value::operator= (this=this@entry=0x7fffffff5d10, a=...)
    at ./libinterp/octave-value/ov.h:366
366             rep->count++;
(gdb) bt
#0  octave_value::operator= (this=this@entry=0x7fffffff5d10, a=...)
    at ./libinterp/octave-value/ov.h:366
#1  0x00007ffff73d55ed in octave::load_fcn_from_file (
    file_name="/home/olaf/octave/parallel-3.1.1/x86_64-pc-linux-gnu-api-v51+/parallel_interface.oct",
    dir_name="/home/olaf/octave/parallel-3.1.1/x86_64-pc-linux-gnu-api-v51+",
    dispatch_type="", package_name="", fcn_name="", autoload=false)
    at libinterp/parse-tree/oct-parse.yy:4753

rest of backtrace varies:

this was what I got in package installation:

#2  0x00007ffff752e800 in octave::fcn_info::fcn_info_rep::find_user_function (
    this=this@entry=0xfaf530) at libinterp/corefcn/fcn-info.cc:757

and this is from with the described procedure to reproduce the bug:

#2  0x00007ffff7892cde in load_out_of_date_fcn (
    ff="/home/olaf/devel/src/test/test_interface.oct", dir_name="",
    function=..., dispatch_type="", package_name="")
    at libinterp/corefcn/symtab.cc:99
#3  0x00007ffff789609c in octave::out_of_date_check (function=...,
    dispatch_type="", check_relative=check_relative@entry=true)
    at libinterp/corefcn/symtab.cc:258
#4  0x00007ffff752d911 in octave::fcn_info::fcn_info_rep::find_autoload (
    this=this@entry=0x7b30a0) at libinterp/corefcn/fcn-info.cc:712
#5  0x00007ffff75304e7 in octave::fcn_info::fcn_info_rep::xfind (
    this=this@entry=0x7b30a0, args=..., local_funcs=local_funcs@entry=true)
    at libinterp/corefcn/fcn-info.cc:504
#6  0x00007ffff7530caf in octave::fcn_info::fcn_info_rep::find (this=0x7b30a0,
    args=..., local_funcs=local_funcs@entry=true)
    at libinterp/corefcn/fcn-info.cc:353
#7  0x00007ffff7894303 in find (local_funcs=true, args=...,
    this=<optimized out>) at libinterp/corefcn/fcn-info.h:244
#8  octave::symbol_table::fcn_table_find (this=this@entry=0x66ee50,
    name="some_function", args=..., local_funcs=local_funcs@entry=true)
    at libinterp/corefcn/symtab.cc:390
#9  0x00007ffff78911c3 in octave::symbol_scope_rep::find (this=0x687b20,
    name="some_function", args=..., skip_variables=skip_variables@entry=true,
    local_funcs=local_funcs@entry=true) at libinterp/corefcn/symscope.cc:84
#10 0x00007ffff7892ebd in find (local_funcs=true, skip_variables=true,
    args=..., name="", this=<optimized out>)
    at libinterp/corefcn/symscope.h:655
#11 octave::symbol_table::find (this=this@entry=0x66ee50,
    name="some_function", args=..., skip_variables=skip_variables@entry=true,
    local_funcs=local_funcs@entry=true) at libinterp/corefcn/symtab.cc:358
#12 0x00007ffff7894855 in octave::symbol_table::find_function (this=0x66ee50,
    name="some_function", args=..., local_funcs=local_funcs@entry=true)
    at libinterp/corefcn/symtab.cc:430
#13 0x00007ffff788f22d in octave::symbol_record::find_function (
    this=this@entry=0x7fffffffdcc0, name="some_function", args=...)
    at libinterp/corefcn/symrec.cc:115
#14 0x00007ffff73f5eed in octave::symbol_record::find (
    this=this@entry=0x7fffffffdcc0, context=context@entry=0, args=...)
    at libinterp/corefcn/symrec.h:562
#15 0x00007ffff73e833b in octave::tree_evaluator::visit_identifier (
    this=0x66ef10, expr=...) at libinterp/parse-tree/pt-eval.cc:1059

Olaf Till <i7tiol>
Project Member

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #43190:  fix-52977.cset added by i7tiol (915B - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by jwe (Posted a comment)
  • -email is unavailable- added by arb (Posted a comment)
  • -email is unavailable- added by i7tiol (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

     

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-04-11 jwe StatusPatch Submitted => Fixed
        Open/ClosedOpen => Closed
    2018-02-06 i7tiol StatusNone => Patch Submitted
    2018-02-06 i7tiol Attached File- => Added fix-52977.cset, #43190

    Back to the top


    Powered by Savane 3.5