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

fatal error: checkptr: unsafe pointer conversion #138

Closed
andrewkroh opened this issue Jul 14, 2020 · 3 comments
Closed

fatal error: checkptr: unsafe pointer conversion #138

andrewkroh opened this issue Jul 14, 2020 · 3 comments
Assignees
Labels

Comments

@andrewkroh
Copy link
Member

Under Go 1.14.4 with the race detector running gosigar fails at

bytes := (*[10000]byte)(unsafe.Pointer(ptr))

=== RUN   TestFetch
fatal error: checkptr: unsafe pointer conversion

goroutine 50 [running]:
runtime.throw(0x48dfb0e, 0x23)
	/Users/akroh/.gvm/versions/go1.14.4.darwin.amd64/src/runtime/panic.go:1116 +0x72 fp=0xc00016b7c8 sp=0xc00016b798 pc=0x4036fd2
runtime.checkptrAlignment(0xc000652458, 0x4819a40, 0x1)
	/Users/akroh/.gvm/versions/go1.14.4.darwin.amd64/src/runtime/checkptr.go:20 +0xc9 fp=0xc00016b7f8 sp=0xc00016b7c8 pc=0x4008e39
github.com/elastic/gosigar.bytePtrToString(0xc000652458, 0x4dbe04f, 0x1)
	/Users/akroh/go/pkg/mod/github.com/elastic/[email protected]/sigar_util.go:10 +0x52 fp=0xc00016b850 sp=0xc00016b7f8 pc=0x4728c12
github.com/elastic/gosigar.(*FileSystemList).Get(0xc00016b9a8, 0x0, 0x0)
	/Users/akroh/go/pkg/mod/github.com/elastic/[email protected]/sigar_darwin.go:183 +0x1e5 fp=0xc00016b950 sp=0xc00016b850 pc=0x4728ea5
github.com/elastic/beats/v7/metricbeat/module/system/filesystem.GetFileSystemList(0x4757d17, 0xc00050a780, 0xc0000bcac0, 0x1, 0x1)
	/Users/akroh/go/src/github.com/elastic/beats/metricbeat/module/system/filesystem/helper.go:55 +0x4e fp=0xc00016b9d0 sp=0xc00016b950 pc=0x475923e
github.com/elastic/beats/v7/metricbeat/module/system/filesystem.(*MetricSet).Fetch(0xc000640a20, 0x49d00e0, 0xc0006171d0, 0x400cfea, 0x486b620)
@andrewkroh andrewkroh added the bug label Jul 14, 2020
@andrewkroh
Copy link
Member Author

One temporary fix would be to annotate the function with //go:nocheckptr (thanks @adriansr).

@andrewkroh
Copy link
Member Author

Running the go test -gcflags=-d=checkptr ./... will reproduce the error.

andrewkroh added a commit to andrewkroh/gosigar that referenced this issue Jul 14, 2020
This is a temporary fix for elastic#138
to ignore the warning.
andrewkroh added a commit to andrewkroh/gosigar that referenced this issue Jul 14, 2020
This is a temporary fix for elastic#138
to ignore the warning.
andrewkroh added a commit that referenced this issue Jul 15, 2020
This is a temporary fix for #138
to ignore the warning.
andrewkroh added a commit to andrewkroh/beats that referenced this issue Jul 15, 2020
The system/filesystem tests are failing due to an unsafe pointer conversion. This
temporarily ignores the unsafe pointer conversion warning. Underlying pointer conversion
issue still needs addressed in gosigar.

elastic/gosigar#138
andrewkroh added a commit to elastic/beats that referenced this issue Jul 15, 2020
The system/filesystem tests are failing due to an unsafe pointer conversion. This
temporarily ignores the unsafe pointer conversion warning. Underlying pointer conversion
issue still needs addressed in gosigar.

elastic/gosigar#138
andrewkroh added a commit to andrewkroh/beats that referenced this issue Jul 15, 2020
The system/filesystem tests are failing due to an unsafe pointer conversion. This
temporarily ignores the unsafe pointer conversion warning. Underlying pointer conversion
issue still needs addressed in gosigar.

elastic/gosigar#138
(cherry picked from commit d629868)
andrewkroh added a commit to elastic/beats that referenced this issue Jul 15, 2020
The system/filesystem tests are failing due to an unsafe pointer conversion. This
temporarily ignores the unsafe pointer conversion warning. Underlying pointer conversion
issue still needs addressed in gosigar.

elastic/gosigar#138
(cherry picked from commit d629868)
melchiormoulin pushed a commit to melchiormoulin/beats that referenced this issue Oct 14, 2020
The system/filesystem tests are failing due to an unsafe pointer conversion. This
temporarily ignores the unsafe pointer conversion warning. Underlying pointer conversion
issue still needs addressed in gosigar.

elastic/gosigar#138
@andrewkroh
Copy link
Member Author

Fixed by #141 according to the PR description.

It does not reproduce for me with Go 1.22.2 under darwin/arm64.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants