runtime: gcWriteBarrier implementations assume argument slots are immutable #25512
Labels
Milestone
Comments
/cc @aclements |
I remember @aclements and I talked about this in the review of the buffered write barrier CL or somewhere. We decided this was ok. wbBufFlush was special enough and we can carefully code it so the argument slots are not clobbered. Probably still good to have a comment. |
Change https://golang.org/cl/127815 mentions this issue: |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
gcWriteBarrier
currently promises to preserve all general purpose registers. It does this by saving the general purpose registers to the stack. However it saves its arguments into the argument slots forgcBufFlush
and then restores them from the same slots. This isn't technically correct. As @randall77 mentioned in this post:This should probably be fixed for correctness. We could either mark
gcWriteBarrier
as clobbering its argument registers and then not bothering to restore them at all or we can save them to the stack somewhere else.Examples of unsafe restores:
amd64:
go/src/runtime/asm_amd64.s
Lines 1451 to 1455 in 5776bd5
s390x:
go/src/runtime/asm_s390x.s
Lines 862 to 865 in 5776bd5
The text was updated successfully, but these errors were encountered: