hefeix / szl

Automatically exported from code.google.com/p/szl
Other
0 stars 0 forks source link

Stack traces walk off the top of the stack into unknown frames #31

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Native mode on linux x86_64 stack traces fail to terminate at the $main or 
$init frame as documented; they continue and produce "no symbolic frame 
information (initialization frame?)" for non-nativecodegen C++ stack frames.

The underlying problem is the incorrect assumption that the stack always grows 
downward with the same layout. This assumption is made in frame.cc:

bool FrameIterator::is_valid() const {
  if (native_)
    return sp() <= proc()->native_bottom_sp();
  [...]
}

In practice, the top szl frame has sp() == proc()->native_bottom_sp(), but 
often the next few C++ frames have values in the "sp" slot which are 
numerically less than the nativecodegen's bottom_sp. FrameIterator::is_valid 
misidentifies them as valid szl native frames.

Walking through memory, deferencing pointers at random, seems dangerous in 
itself. That's why this is a separate bug and not just part of issue 19.

Original issue reported on code.google.com by aecolley on 13 Oct 2013 at 9:32

Attachments: