You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
cmd/compile: inconsistent integer arithmetic result on Go 1.22+arm64 with/without -race [1.22 backport] #68230
changed the title [-]Inconsistent integer arithmetic result on Go 1.22+arm64 with/without -race [1.22 backport][/-][+]cmd/compile: inconsistent integer arithmetic result on Go 1.22+arm64 with/without -race [1.22 backport][/+]on Jun 28, 2024
@randall77 is it within the realm of possibility that this issue could lead to a GC crash like the one below? (perhaps in the presence of unsafe code that does non-trivial pointer arithmetic)
That fault is because the runtime's internal data is corrupted. For that to happen, we'd have to use the bug to calculate a bad offset during some unsafe.Pointer arithmetic. The bug only causes errors in the high 32 bits, so the bad address would be off by a multiple of 4GB. I guess if your heap is that big, it's possible. For smaller heaps I don't see how you could corrupt the heap using this bug.
The high 32 bit error could apply to an intermediary result, which then causes us to get an incorrect pointer that is less than 4GB away no? For example things like (x * largeConstant) >> 32 are sometimes used as hash functions.
The high 32 bit error could apply to an intermediary result, which then causes us to get an incorrect pointer that is less than 4GB away no?
Sure, it is possible.
For example things like (x * largeConstant) >> 32 are sometimes used as hash functions.
That particular case seems unlikely to be the problem, as a hash function would certainly be followed by a bounds check or mask. It might cause a hash miss where there should be a hit, but that shouldn't corrupt runtime state.
Activity
[-]Inconsistent integer arithmetic result on Go 1.22+arm64 with/without -race [1.22 backport][/-][+]cmd/compile: inconsistent integer arithmetic result on Go 1.22+arm64 with/without -race [1.22 backport][/+]gopherbot commentedon Jun 28, 2024
Change https://go.dev/cl/595696 mentions this issue:
[release-branch.go1.22] cmd/compile: don't elide zero extension on top of signed valuesrandall77 commentedon Jun 28, 2024
This issue leads to miscompilation in rare cases involving sign/zero extension and register spill/restore paths.
[release-branch.go1.22] cmd/compile: don't elide zero extension on to…
gopherbot commentedon Jul 10, 2024
Closed by merging 45f9ded to release-branch.go1.22.
RaduBerinde commentedon Nov 5, 2024
@randall77 is it within the realm of possibility that this issue could lead to a GC crash like the one below? (perhaps in the presence of
unsafecode that does non-trivial pointer arithmetic)(this is from cockroachdb/cockroach#134020)
randall77 commentedon Nov 5, 2024
I guess it is possible, but not terribly likely.
That fault is because the runtime's internal data is corrupted. For that to happen, we'd have to use the bug to calculate a bad offset during some
unsafe.Pointerarithmetic. The bug only causes errors in the high 32 bits, so the bad address would be off by a multiple of 4GB. I guess if your heap is that big, it's possible. For smaller heaps I don't see how you could corrupt the heap using this bug.RaduBerinde commentedon Nov 5, 2024
The high 32 bit error could apply to an intermediary result, which then causes us to get an incorrect pointer that is less than 4GB away no? For example things like
(x * largeConstant) >> 32are sometimes used as hash functions.randall77 commentedon Nov 5, 2024
Sure, it is possible.
That particular case seems unlikely to be the problem, as a hash function would certainly be followed by a bounds check or mask. It might cause a hash miss where there should be a hit, but that shouldn't corrupt runtime state.