-
Notifications
You must be signed in to change notification settings - Fork 300
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
workerd: windows-debug build fails string-test #1334
Comments
Additional note: it is possible to use CodeLLDB on Windows which opens up the possibility of using the V8 lldb debugger extensions. Install CodeLLDB, then add a new target to
Then copy The code on the stack is fairly compact / terse with generated code (probably interpreter) in the mix too. |
Looks like a problem with the way UTF8 characters in the source are interpreted on Windows. That said, I'm in the process of phasing out |
Thanks James. I don't dispute the suggestion, but observe that the test only fails for debug builds and the line failing does not encompass anything special in UTF-8: e.expectEval("testUsvPtr('hello')", "string", "hello"); The preceding line passes: e.expectEval("testUsv('hello')", "string", "hello"); Looking in the debugger, there is a minor iceberg code contained within the trivial looking function UsvStringPtr testUsvPtr(jsg::Optional<UsvString> str) {
return kj::mv(str).orDefault(usv("undefined"));
} Near the end of the code called here is a call to Looks like this works via UAF on our other builds and we might be able to fix this with an ownership transfer of the memory or keeping the memory around longer. 😨 |
Hmm, I'm not so sure there is a good route for this given the method signature: UsvStringPtr testUsvPtr(jsg::Optional<UsvString> str) {
return kj::mv(str).orDefault(usv("undefined"));
} The UsvStringPtr testUsvPtr(jsg::Optional<UsvString>& str) {
return kj::mv(str).orDefault(usv("undefined"));
} barfs during compilation:
In conclusion, I'm not able to see a good fix for this other than dropping the test. If we think this pattern might occur in real code, we'll need a better fix. |
The windows-debug config exposed a UAF for the testUsvPtr() test in the KJ_TEST("JavaScript USVStrings") since the debug build on Windows overwrites freed memory which shows up as corruption if used after free. The issue is described in #1334. Fix: #1334 Test: bazel test -c dbg --cache_test_results=no //...
The windows-debug config exposed a UAF for the testUsvPtr() test in the KJ_TEST("JavaScript USVStrings") since the debug build on Windows overwrites freed memory which shows up as corruption if used after free. The issue is described in #1334. Fix: #1334 Test: bazel test -c dbg --cache_test_results=no //...
More test configurations for workerd were added this week in #1283.
The PR includes a few lines that remove the windows-debug configuration from the matrix in test.yml.
There is a test failure for windows-debug that repros with:
bazel test --config=debug //src/workerd/jsg:string-test
And for debugging purposes in VSCode through
Run and debug
->workerd test case (dbg)
->bazel-bin/src/workerd/jsg/string-test
. The test failure is:The point of failure is string-test.c++:373. This is the only test that uses
testUsvPtr
.An initial suspicion was that this could be attributable to differences in compiler macros, but no evidence supports this for now. The notable differences are the addition of
/DDEBUG /DV8_ENABLE_CHECKS
to the V8 build flags and changing from/MD
to/MDd
.The text was updated successfully, but these errors were encountered: