Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 328989 - setting Text.isLoaded to true causes Diags_setMask() to access random memory
Summary: setting Text.isLoaded to true causes Diags_setMask() to access random memory
Status: CLOSED FIXED
Alias: None
Product: RTSC
Classification: Technology
Component: Tools (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 critical (vote)
Target Milestone: ---   Edit
Assignee: Dave Russo CLA
QA Contact:
URL:
Whiteboard: target:3.20.05,3.21
Keywords:
Depends on:
Blocks:
 
Reported: 2010-10-28 17:53 EDT by Dave Russo CLA
Modified: 2011-06-20 14:05 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dave Russo CLA 2010-10-28 17:53:02 EDT
Diags_setMask() calls Text_matchRope(), but Text_matchRope() is undefined if Text.isLoaded is true.

On systems that have memory protection the following configuration will cause segmentation faults (depending on the exact placement of xdc.noload) id Diags_setmask() is called:

    var Diags  = xdc.useModule("xdc.runtime.Diags");
    var Main = xdc.useModule("xdc.runtime.Main");

    /* unnamed modules can not be enabled/disabled at runtime */
    Main.common$.namedModule = true;

    /* if text is not loaded, Diags setMask() can't work */
    var Text = xdc.useModule("xdc.runtime.Text");
    Text.isLoaded = false;
Comment 1 Dave Russo CLA 2010-10-28 18:23:38 EDT
fixed in 3.21 stream (r1198) should probably be propagated to 3.20 as well.
Comment 2 Dave Russo CLA 2010-11-01 12:08:52 EDT
fixed in 3.20 stream (r1210)
Comment 3 Sasha Slijepcevic CLA 2010-11-15 23:07:16 EST
When building the example runtime.assert with 3.21.00.19 for native Linux, the built executable fails with a segmentation fault.
With 3.21.00.24, the executable runs to the completion succesfully.

However, the changes I had to make were little bit different than proposed in the first comment. I had to change a module other than Main.
System.common$.namedModule = true;
System.common$.diags_INTERNAL = Diags.RUNTIME_OFF;

With Main, both executables ran fine.
Comment 4 Sasha Slijepcevic CLA 2010-11-15 23:07:57 EST
When building the example runtime.assert with 3.21.00.19 for native Linux, the
built executable fails with a segmentation fault.
With 3.21.00.24, the executable runs to the completion succesfully.

However, the changes I had to make were little bit different than proposed in
the first comment. I had to change a module other than Main.
System.common$.namedModule = true;
System.common$.diags_INTERNAL = Diags.RUNTIME_OFF;

With Main, both executables ran fine.
Comment 5 Sasha Slijepcevic CLA 2010-11-15 23:18:51 EST
The bug is not fixed yet in 3.20.05 stream because the latest xdc-v52 was released before the fix was committed to the repository. We need another xdc-v.
Comment 6 Sasha Slijepcevic CLA 2010-11-17 18:48:53 EST
Verified that 3.20.05.74 causes a segmentation error for the given example, while 3.20.05.75 runs correctly to the completion.
Comment 7 Sasha Slijepcevic CLA 2010-11-18 12:32:49 EST
Verified that 3.20.05.74 causes a segmentation error for the given example,
while 3.20.05.75 runs correctly to the completion.
Comment 8 Dave Russo CLA 2011-06-20 14:05:04 EDT
Shipped in XDCtools 3.21