bugGNU Octave - Bugs: bug #64817, VM seems to get out of sync in...

 
 

bug #64817: VM seems to get out of sync in certain situations and throws error / produces core dump

Submitter:  None
Submitted:  Thu 26 Oct 2023 03:43:35 AM UTC
   
 
Category:  None Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Segfault, Bus Error, etc.
Status:  Ready For Test Assigned to:  None
Originator Name:  Originator Email:  -email is unavailable-
Open/Closed:  * Open Release:  * dev
Operating System:  * GNU/Linux Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Sat 28 Oct 2023 02:25:16 PM UTC, comment #2: 

I've made a patch that addresses the issue.


Don't mix up field and id slots when creating bytecode script frames (bug #64817)

Instead of looking up variables by name lineary in the slot name data, use
a map.

* stack-frame.cc: Use map for id lookup
* pt-bytecode-walk.cc: Populate map
* pt-bytecode.h: Change set to map
* test/compile/bytecode_struct.m: Update tests
* test/compile/module.mk: Add new test script
* test/compile/script_defines_qweqwe.m: New test script



Builds on:
https://savannah.gnu.org/bugs/?64827
https://savannah.gnu.org/bugs/?64829
https://savannah.gnu.org/bugs/?64830
https://savannah.gnu.org/bugs/?64832
https://savannah.gnu.org/bugs/?64834

(file #55287)

Petter <petter>
Thu 26 Oct 2023 10:42:21 PM UTC, comment #1: 

Thanks for the test. I am able to replicate the issue.

Petter <petter>
Thu 26 Oct 2023 03:43:35 AM UTC, original submission:  

The VM either
- throws an error „VM internal error: Invalid internal offset. Smaller than original size and not in table“ when calling a script OR
- produces a core dump when the same script commands are just executed on the command line OR
- produces a core dump when the logic the enable/disable the VM is removed from a script and the VM just enabled on the command line.

Overall adding or removing a variable or exchanging a variable to a struct variable or slightly changing the logic seems to have an impact on the error, so I guess that the VM gets out of sync. Also important seems to have an unknown function / unknown function parameter as struct in the code (but this code will never be executed), but the error/core dump yes/no logic related to any code changes escapes me...


The HG-id is ffc410f26506, so all VM patches before today are in.


When calling test1.m, the VM throws an error:
"VM internal error: Invalid internal offset. Smaller than original size and not in table
VM error 7566: Exception in Snippet_test3 escaped the VM
error: VM error 7567: Exception in Snippet_test3 escaped the VM
error: called from
    Snippet_test3
    test2 at line 3 column 3
    test1 at line 4 column 6"

When the same commands are executed on the command line, a core dump is produced.

When the VM enable/disable logic lines are removed from Snippet_test3.m, the VM enabled on the command line and test1.m is executed, a core dump is produced.


Without the VM active (e.g. setting VM_Compile = false or simply removing the lines in the script), there is no problem.


test1.m

source Snippet_test3.m
do
 New = test2(0);
until New;


test2.m

function retval = test2 (t1)

  source Snippet_test3.m;
  Fs = readdir(files.model_path);
  do
    if false
      P = I_Do_No_Exist(Var_Does_Not_Exist_As_Well.Take);
    endif
  until true

  retval = !t1;
endfunction




Snippet_test3.m

files = struct();
files.model_path = pwd ();
Fs = readdir(files.model_path);
Take = false(size(Fs));

# if all the lines below are removed and the VM is just enabled on the command line,
# then a core dump is produced without the VM throwing an error.
VM_Compile = true;
if VM_Compile
  __vm_enable__ (1);
else
  __vm_enable__ (0);
endif


Anonymous

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #55287:  octave_32632.patch added by petter (12KiB - text/plain)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by arungiridhar (Updated the item)
  • -email is unavailable- added by petter (Posted a comment)
  •  

    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 project members can vote.

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2023-10-28 arungiridhar StatusNone Ready For Test
    2023-10-28 petter Attached File- Added octave_32632.patch, #55287

    Back to the top

    Powered by Savane 3.12