Skip to content
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

sync/atomic: TestSwapPointer violates checkptr rules #38210

Closed
randall77 opened this issue Apr 1, 2020 · 2 comments
Closed

sync/atomic: TestSwapPointer violates checkptr rules #38210

randall77 opened this issue Apr 1, 2020 · 2 comments

Comments

@randall77
Copy link
Contributor

When running the race detector on the linux/arm64 builder, I get this error:

fatal error: checkptr: pointer arithmetic result points to invalid allocation

goroutine 24 [running]:
runtime.throw(0x1f986e, 0x40)
	/workdir/go/src/runtime/panic.go:1116 +0x54 fp=0x4000050dc0 sp=0x4000050d90 pc=0x6946c
runtime.checkptrArithmetic(0x4000000000, 0x0, 0x0, 0x0)
	/workdir/go/src/runtime/checkptr.go:43 +0xbc fp=0x4000050df0 sp=0x4000050dc0 pc=0x3e924
sync/atomic_test.TestSwapPointer(0x40001526c0)
	/workdir/go/src/sync/atomic/atomic_test.go:168 +0x10c fp=0x4000050ec0 sp=0x4000050df0 pc=0x18be64

The test is clearly doing things that violate the checkptr rules. It constructs pointers which are powers of 2, starting at 2^16, and makes sure SwapPointer handles them correctly. But one of those powers of two, 0x4000000000, just happens to point to a bad place in the heap.

This test probably needs to be rewritten to use valid pointers.

This is blocking the building of new race detector syso files for 1.15, so this issue is blocking 1.15 as well.

cc: @mdempsky

@randall77 randall77 added this to the Go1.15 milestone Apr 1, 2020
@randall77
Copy link
Contributor Author

@dvyukov who wrote the original test.

@gopherbot
Copy link

Change https://golang.org/cl/226880 mentions this issue: sync/atomic: fix TestSwapPointer test

@golang golang locked and limited conversation to collaborators Apr 2, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants