Skip to content

Fatal error when running under the race detector #2

Description

@cetetesoft

I'm running the journalscan command with no issues on Windows 11.

However, when adding the -race flag to go run:
go run -race . c:
The program exits with the following stack trace:

Path: "c:"
fatal error: checkptr: converted pointer straddles multiple allocations

goroutine 1 [running]:
runtime.throw({0x5ce02d?, 0x0?})
        C:/Program Files/Go/src/runtime/panic.go:1047 +0x65 fp=0xc000129558 sp=0xc000129528 pc=0x472e65
runtime.checkptrAlignment(0x0?, 0x0?, 0x0?)
        C:/Program Files/Go/src/runtime/checkptr.go:26 +0x6c fp=0xc000129578 sp=0xc000129558 pc=0x4443ec
github.com/gentlemanautomaton/volmgmt/mountapi.utf16BytesToString(...)
        C:/Users/cs/go/pkg/mod/github.com/gentlemanautomaton/volmgmt@v0.0.0-20230309020842-3547e8af63cf/mountapi/unicode.go:9
github.com/gentlemanautomaton/volmgmt/mountapi.QueryDeviceName(0xc00006c460?)
        C:/Users/cs/go/pkg/mod/github.com/gentlemanautomaton/volmgmt@v0.0.0-20230309020842-3547e8af63cf/mountapi/syscall.go:37 +0x79 fp=0xc0001295d8 sp=0xc000129578 pc=0x57a8d9
github.com/gentlemanautomaton/volmgmt/volume.(*Volume).DevicePath(0xc00013a000)
        C:/Users/cs/go/pkg/mod/github.com/gentlemanautomaton/volmgmt@v0.0.0-20230309020842-3547e8af63cf/volume/volume.go:188 +0x45 fp=0xc000129610 sp=0xc0001295d8 pc=0x57c6e5
main.printVolume(0xc00013a000)
        C:/Users/cs/go/pkg/mod/github.com/gentlemanautomaton/volmgmt@v0.0.0-20230309020842-3547e8af63cf/cmd/journalscan/scan.go:99 +0x9f fp=0xc0001297c0 sp=0xc000129610 pc=0x590fff
main.scan({0x5f7990, 0xc000014078}, {0xc00001410e, 0x2}, {0xffffffff, 0x0, 0x0, {0x0, 0x0, 0x0}, ...})
        C:/Users/cs/go/pkg/mod/github.com/gentlemanautomaton/volmgmt@v0.0.0-20230309020842-3547e8af63cf/cmd/journalscan/scan.go:30 +0x2d5 fp=0xc000129dd0 sp=0xc0001297c0 pc=0x58f955
main.main()
        C:/Users/cs/go/pkg/mod/github.com/gentlemanautomaton/volmgmt@v0.0.0-20230309020842-3547e8af63cf/cmd/journalscan/main.go:81 +0x90f fp=0xc000129f80 sp=0xc000129dd0 pc=0x58f46f
runtime.main()
        C:/Program Files/Go/src/runtime/proc.go:250 +0x1f7 fp=0xc000129fe0 sp=0xc000129f80 pc=0x4755d7
runtime.goexit()
        C:/Program Files/Go/src/runtime/asm_amd64.s:1598 +0x1 fp=0xc000129fe8 sp=0xc000129fe0 pc=0x4a0521

...

If I skip the call to printVolume() on scan.go, I still get another error:

Path: "c:"
USN Journal: Present, ID: 133191051541552939, Oldest USN: 9361686528, Next USN: 9401699344, Supporting Versions: 2-4
Scanning MFT...runtime: pointer 0xc00013e0d9 to unused region of span span.base()=0xc000100000 span.limit=0xc00013e010 span.state=1
fatal error: found bad pointer in Go heap (incorrect use of unsafe or cgo?)

...

I'm new to Golang, so I'm not sure if I should be concerned with these errors or it's safe to ignore them.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions