-
Notifications
You must be signed in to change notification settings - Fork 5.2k
[wasm][debugger] - RuntimeError: memory access out of bounds #51859
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Tagging subscribers to this area: @thaystg Issue DetailsAddressing #51276
On top of that
|
Tagging subscribers to 'arch-wasm': @lewing Issue DetailsAddressing #51276
On top of that
|
There are few more places which throw memory access out of bounds, converted to draft. |
3e927fa
to
64a5a32
Compare
/azp list |
Supported commands
See additional documentation. |
Commenter does not have sufficient privileges for PR 51859 in repo dotnet/runtime |
/azp list |
Commenter does not have sufficient privileges for PR 51859 in repo dotnet/runtime |
/azp run runtime |
Commenter does not have sufficient privileges for PR 51859 in repo dotnet/runtime |
/azp run runtime |
Azure Pipelines successfully started running 1 pipeline(s). |
64a5a32
to
50cb01c
Compare
src/mono/wasm/debugger/tests/debugger-test/debugger-test.csproj
Outdated
Show resolved
Hide resolved
c924733
to
23a35a1
Compare
IIUC, the real issue here is when you are paused "before the method has started" .. and try to look at a local, then that is NULL. I would suggest:
await SetBreakpointInMethod("debugger-test.dll", "WithStringBuilder", "OuterMethod", 0);
await EvaluateAndCheck("window.setTimeout(function() { invoke_static_method('[debugger-test] WithStringBuilder:OuterMethod'); }, 1);", "dotnet://debugger-test.dll/debugger-test.cs", 561, 5, "OuterMethod");
await StepAndCheck(StepKind.Into, "dotnet://debugger-test.dll/debugger-test.cs", 566, 5, "InnerMethod", times: 2,
locals_fn: async (locals) => await CheckProps(locals, new
{
sb = TObject("System.Text.StringBuilder", is_null: true)
}, "locals"));
await StepAndCheck(StepKind.Into, "dotnet://debugger-test.dll/debugger-test.cs", 567, 9, "InnerMethod", times: 1,
locals_fn: async (locals) => await CheckProps(locals, new
{
sb = TObject("System.Text.StringBuilder")
}, "locals"));
|
- fix null reference in PDB load - improved handling of targetCrashed in Inspector - improve Makefile to allow passing test arguments together with filters - add windows chrome to probe path - include debugging payload into test failure exception for easier debugging - make it possible to compile with WasmBuildNative=true - make it possible to compile with Debug runtime - enable Mono logging in debug mode
23a35a1
to
4bd84ac
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lots of nice improvements here. I'm doing a local testing before approving because of the CI situation.
For the cases that are actually being fixed here, IMHO, the new tests should be explicit that they are testing the case of looking at locals before they get initialized. So, maybe name it like that, and the test code can be like: 1 public static int OuterMethod()
2 {
3 MONO_TYPE_CLASS mtc;
4 Console.WriteLine("break here"); // breakpoint here
5 mtc = new MONO_TYPE_CLASS();
6 Console.WriteLine($"mtc: {mtc}");
7 } Set breakpoint on line 4. Get the locals there: var pause_location = await EvaluateAndCheck(...
var locals = await GetProperties(pause_location["callFrames"][0]["callFrameId"].Value<string>()); Otherwise, the tests seem like they are accidentally checking the case. |
With a clean DEBUG runtime build, the
{
"timestamp": 1620228774790.821,
"exceptionDetails": {
"exceptionId": 3,
"text": "Uncaught",
"lineNumber": 37,
"columnNumber": 2,
"scriptId": "8",
"url": "http://localhost:9400/dotnet.js",
"stackTrace": {
"callFrames": [
{
"functionName": "quit_",
"scriptId": "8",
"url": "http://localhost:9400/dotnet.js",
"lineNumber": 37,
"columnNumber": 2
},
{
"functionName": "exit",
"scriptId": "8",
"url": "http://localhost:9400/dotnet.js",
"lineNumber": 11616,
"columnNumber": 2
},
{
"functionName": "_exit",
"scriptId": "8",
"url": "http://localhost:9400/dotnet.js",
"lineNumber": 6056,
"columnNumber": 6
},
{
"functionName": "monoeg_assertion_message",
"scriptId": "11",
"url": "http://localhost:9400/dotnet.wasm",
"lineNumber": 0,
"columnNumber": 1889128
},
{
"functionName": "mono_assertion_message",
"scriptId": "11",
"url": "http://localhost:9400/dotnet.wasm",
"lineNumber": 0,
"columnNumber": 1889214
},
{
"functionName": "mono_de_ss_req_release",
"scriptId": "11",
"url": "http://localhost:9400/dotnet.wasm",
"lineNumber": 0,
"columnNumber": 1830351
},
{
"functionName": "mono_de_process_single_step",
"scriptId": "11",
"url": "http://localhost:9400/dotnet.wasm",
"lineNumber": 0,
"columnNumber": 1831800
},
{
"functionName": "mono_wasm_single_step_hit",
"scriptId": "11",
"url": "http://localhost:9400/dotnet.wasm",
"lineNumber": 0,
"columnNumber": 1810692
},
{
"functionName": "do_debugger_tramp",
"scriptId": "11",
"url": "http://localhost:9400/dotnet.wasm",
"lineNumber": 0,
"columnNumber": 171020
},
{
"functionName": "interp_exec_method",
"scriptId": "11",
"url": "http://localhost:9400/dotnet.wasm",
"lineNumber": 0,
"columnNumber": 145696
},
{
"functionName": "interp_runtime_invoke",
"scriptId": "11",
"url": "http://localhost:9400/dotnet.wasm",
"lineNumber": 0,
"columnNumber": 36309
},
{
"functionName": "mono_jit_runtime_invoke",
"scriptId": "11",
"url": "http://localhost:9400/dotnet.wasm",
"lineNumber": 0,
"columnNumber": 1562745
},
{
"functionName": "do_runtime_invoke",
"scriptId": "11",
"url": "http://localhost:9400/dotnet.wasm",
"lineNumber": 0,
"columnNumber": 902006
},
{
"functionName": "mono_runtime_try_invoke",
"scriptId": "11",
"url": "http://localhost:9400/dotnet.wasm",
"lineNumber": 0,
"columnNumber": 904955
},
{
"functionName": "mono_runtime_invoke",
"scriptId": "11",
"url": "http://localhost:9400/dotnet.wasm",
"lineNumber": 0,
"columnNumber": 921755
},
{
"functionName": "mono_wasm_invoke_method",
"scriptId": "11",
"url": "http://localhost:9400/dotnet.wasm",
"lineNumber": 0,
"columnNumber": 2954696
},
{
"functionName": "",
"scriptId": "8",
"url": "http://localhost:9400/dotnet.js",
"lineNumber": 1430,
"columnNumber": 21
},
{
"functionName": "ccall",
"scriptId": "8",
"url": "http://localhost:9400/dotnet.js",
"lineNumber": 644,
"columnNumber": 17
},
{
"functionName": "",
"scriptId": "8",
"url": "http://localhost:9400/dotnet.js",
"lineNumber": 656,
"columnNumber": 11
},
{
"functionName": "managed__debugger_test__DebuggerTests_MONO_TYPE_VALUETYPE2_OuterMethod",
"scriptId": "48",
"url": "https://mono-wasm.invalid/managed__debugger_test__DebuggerTests_MONO_TYPE_VALUETYPE2_OuterMethod",
"lineNumber": 14,
"columnNumber": 39
},
{
"functionName": "invoke_static_method",
"scriptId": "5",
"url": "http://localhost:9400/debugger-driver.html",
"lineNumber": 25,
"columnNumber": 10
},
{
"functionName": "",
"scriptId": "47",
"url": "",
"lineNumber": 0,
"columnNumber": 31
}
]
},
"exception": {
"type": "object",
"className": "ExitStatus",
"description": "ExitStatus",
"objectId": "7004380125509995368.2.141",
"preview": {
"type": "object",
"description": "ExitStatus",
"overflow": false,
"properties": [
{
"name": "name",
"type": "string",
"value": "ExitStatus"
},
{
"name": "message",
"type": "string",
"value": "Program terminated with exit(0)"
},
{
"name": "status",
"type": "number",
"value": "0"
}
]
}
},
"executionContextId": 2
}
} |
We agreed with @radical that we would open another issue 52445 for 'req->refcount not met' problem as it reproduces even without the runtime changes on this PR. I renamed files and methods to make it clear what is just preparation and what is actually being tested. I also added comments. |
Sorry, I wasn't clear. I meant that these tests are not related to Stepping, but are about trying to read values for locals before they get initialized. And so, I was suggesting that we should rename the xunit test names to reflect that. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other than the comments, looks good. Thank you for testing on windows, and with Debug
!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other than the cleanup comments, looks good 👍
locals_fn: (locals) => | ||
{ | ||
Assert.Equal(2, locals.Count()); | ||
Check(locals, "r", checkDefault); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of the new overloads that use CheckValue
, you can use:
await CheckProps(locals, new
{
r = checkDefault
}, "default", num_fields: 2);
But since this needs to be async, you will need to do:
var pause_location = await StepAndCheck(StepKind.Into, "dotnet://debugger-test.dll/debugger-assignment-test.cs", -1, -1, "TestedMethod");
var locals = await GetProperties(pause_location["callFrames"][0]["callFrameId"].Value<string>());
await CheckProps(locals, new
{
r = checkDefault
}, "default", num_fields: 2);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, we can do any more clean-up in followups
Fixes #51276
On top of that