-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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
x/tools/gopls: panic in aeshashbody on behalf of mapaccess2_faststr: string memory corrupted #71367
Comments
In person, Alan was saying that some of this string must have already been read (hence the assumption that it crosses a page boundary), but actually https://cs.opensource.google/go/go/+/master:src/runtime/asm_amd64.s;l=1471;drc=7f9edb42259114020c67eb51643e43cf5a2cf9a7 (the off-by-one load) is the first load of AX in the function, so it could be any arbitrary bad address. |
I can reproduce a crash at the suspected line with:
Alan, can you reproduce the off-by-one-instruction thing with stacks using this program? Just to check that we're actually looking at the right problem. |
Good catch! Sorry, I was lazy reading the code and assumed from the large func-relative offset and the AESENC before a load that we were in the middle of the loop, but in fact we're just priming the pump.
Yeah, it would be good to definitively resolve some of these questions. I feel bad looping in compiler+runtime folks each time we get an unexplained crash, which has started happening a lot in recent weeks, and Rob has a plausible theory about a data race tearing a string (which is even more plausible if this crash works for any bad string pointer). Will test presently. |
I spliced that code into gopls' main and got this system traceback:
where
In the telemetry database, we get:
where the line aeshashbody:+220, starting counting at zero for the first instruction in the function body, corresponds to the same VLD1.P instruction. So that's good: the telemetry data is consistent with the traceback (no off-by-one), and the implicated instruction is the load, and it fails for any invalid string data. Thanks for your help and sorry for the false alarm. |
amd64 might have different line number behavior than arm64. |
Issue created by stacks.
The source line
aeshashbody:+233
is nominally 1468, but AESENC is infallible. Assuming there's an off-by-one error in computing the relative lines for assembly functions, it could conceivably be the following load instruction, which would mean that a Go string points to data that runs off the end of a memory mapping. I have no idea what is going on. @prattmic[Update: a bad string was passed to a map. Perhaps produced by a data race?]
This stack
8jk_dA
was reported by telemetry:crash/crash
runtime.throw:+9
runtime.sigpanic:+33
.aeshashbody:+233
runtime.mapaccess2_faststr:+67
golang.org/x/tools/internal/gcimporter.(*iimporter).doDecl:+14
golang.org/x/tools/internal/gcimporter.iimportCommon:+179
golang.org/x/tools/internal/gcimporter.IImportShallow:+3
golang.org/x/tools/gopls/internal/cache.(*typeCheckBatch).importPackage:+63
golang.org/x/tools/gopls/internal/cache.(*typeCheckBatch).getImportPackage.func1:+23
golang.org/x/tools/gopls/internal/cache.(*futureCache[...]).get:+32
golang.org/x/tools/gopls/internal/cache.(*typeCheckBatch).getImportPackage:+1
golang.org/x/tools/gopls/internal/cache.(*typeCheckBatch).importPackage.func1:+26
golang.org/x/tools/internal/gcimporter.iimportCommon:+124
golang.org/x/tools/internal/gcimporter.IImportShallow:+3
golang.org/x/tools/gopls/internal/cache.(*typeCheckBatch).importPackage:+63
golang.org/x/tools/gopls/internal/cache.(*typeCheckBatch).getImportPackage.func1:+23
The text was updated successfully, but these errors were encountered: