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

unsafe pointer conversion on Linux #330

Closed
cpuguy83 opened this issue Mar 11, 2020 · 1 comment · Fixed by #325 or tilt-dev/fsnotify#7
Closed

unsafe pointer conversion on Linux #330

cpuguy83 opened this issue Mar 11, 2020 · 1 comment · Fixed by #325 or tilt-dev/fsnotify#7

Comments

@cpuguy83
Copy link
Contributor

When testing with -race from go1.14 we see a new error in this line of code:

bytes := (*[unix.PathMax]byte)(unsafe.Pointer(&buf[offset+unix.SizeofInotifyEvent]))

$ go test --race ./...

fatal error: checkptr: unsafe pointer conversion

goroutine 50 [running]:

runtime.throw(0x6386c3, 0x23)

	/home/travis/.gimme/versions/go1.14.linux.amd64/src/runtime/panic.go:1112 +0x72 fp=0xc000055b38 sp=0xc000055b08 pc=0x4600a2

runtime.checkptrAlignment(0xc00023b010, 0x5f9be0, 0x1)

	/home/travis/.gimme/versions/go1.14.linux.amd64/src/runtime/checkptr.go:18 +0xb7 fp=0xc000055b68 sp=0xc000055b38 pc=0x433537

github.com/fsnotify/fsnotify.(*Watcher).readEvents(0xc000088410)

	/home/travis/gopath/src/github.com/fsnotify/fsnotify/inotify.go:275 +0x5e5 fp=0xc000055fd8 sp=0xc000055b68 pc=0x5c96d5

runtime.goexit()

	/home/travis/.gimme/versions/go1.14.linux.amd64/src/runtime/asm_amd64.s:1373 +0x1 fp=0xc000055fe0 sp=0xc000055fd8 pc=0x493511

created by github.com/fsnotify/fsnotify.NewWatcher

	/home/travis/gopath/src/github.com/fsnotify/fsnotify/inotify.go:59 +0x31d

goroutine 1 [chan receive]:

testing.(*T).Run(0xc0000d2000, 0x633ea4, 0x13, 0x63c3a0, 0x1)

	/home/travis/.gimme/versions/go1.14.linux.amd64/src/testing/testing.go:1044 +0x699

testing.runTests.func1(0xc0000d2000)

	/home/travis/.gimme/versions/go1.14.linux.amd64/src/testing/testing.go:1285 +0xa7

testing.tRunner(0xc0000d2000, 0xc0000b3d50)

	/home/travis/.gimme/versions/go1.14.linux.amd64/src/testing/testing.go:992 +0x1ec

testing.runTests(0xc0000bc020, 0x7a18c0, 0x23, 0x23, 0x0)

	/home/travis/.gimme/versions/go1.14.linux.amd64/src/testing/testing.go:1283 +0x528

testing.(*M).Run(0xc0000ce000, 0x0)

	/home/travis/.gimme/versions/go1.14.linux.amd64/src/testing/testing.go:1200 +0x300

main.main()

	_testmain.go:112 +0x224

goroutine 24 [chan receive]:

testing.(*T).Parallel(0xc0000d2480)

	/home/travis/.gimme/versions/go1.14.linux.amd64/src/testing/testing.go:867 +0x3b7

github.com/fsnotify/fsnotify.TestWatcherClose(0xc0000d2480)

	/home/travis/gopath/src/github.com/fsnotify/fsnotify/fsnotify_test.go:50 +0x40

testing.tRunner(0xc0000d2480, 0x63c428)

	/home/travis/.gimme/versions/go1.14.linux.amd64/src/testing/testing.go:992 +0x1ec

created by testing.(*T).Run

	/home/travis/.gimme/versions/go1.14.linux.amd64/src/testing/testing.go:1043 +0x661

goroutine 33 [select]:

github.com/fsnotify/fsnotify.TestInotifyOverflow(0xc0000d2900)

	/home/travis/gopath/src/github.com/fsnotify/fsnotify/inotify_test.go:426 +0x840

testing.tRunner(0xc0000d2900, 0x63c3a0)

	/home/travis/.gimme/versions/go1.14.linux.amd64/src/testing/testing.go:992 +0x1ec

created by testing.(*T).Run

	/home/travis/.gimme/versions/go1.14.linux.amd64/src/testing/testing.go:1043 +0x661

FAIL	github.com/fsnotify/fsnotify	3.951s

FAIL

The command "go test --race ./..." exited with 1.
@nathany nathany changed the title unsafe pointer conversion unsafe pointer conversion on Linux Mar 11, 2020
tklauser added a commit to tklauser/fsnotify that referenced this issue Mar 25, 2020
Fix the following unsafe pointer conversion found using the Go 1.14
-d=checkptr gcflags (`go1.14rc1 test -gcflags=all=-d=checkptr -v ./...`)

```
fatal error: checkptr: unsafe pointer conversion

goroutine 68 [running]:
runtime.throw(0x5833e9, 0x23)
	runtime/panic.go:1112 +0x72 fp=0xc00030fba8 sp=0xc00030fb78 pc=0x432a32
runtime.checkptrAlignment(0xc00031f018, 0x544800, 0x1)
	runtime/checkptr.go:18 +0xb7 fp=0xc00030fbd8 sp=0xc00030fba8 pc=0x4063a7
github.com/fsnotify/fsnotify.(*Watcher).readEvents(0xc0002900f0)
	github.com/fsnotify/fsnotify/inotify.go:275 +0x457 fp=0xc00031ffd8 sp=0xc00030fbd8 pc=0x519037
runtime.goexit()
	runtime/asm_amd64.s:1375 +0x1 fp=0xc00031ffe0 sp=0xc00031ffd8 pc=0x463eb1
created by github.com/fsnotify/fsnotify.NewWatcher
	github.com/fsnotify/fsnotify/inotify.go:59 +0x1a5
```

Fixes fsnotify#330
@tklauser
Copy link
Contributor

Should be fixed by #325

cpuguy83 pushed a commit that referenced this issue Apr 17, 2020
Fix the following unsafe pointer conversion found using the Go 1.14
-d=checkptr gcflags (`go1.14rc1 test -gcflags=all=-d=checkptr -v ./...`)

```
fatal error: checkptr: unsafe pointer conversion

goroutine 68 [running]:
runtime.throw(0x5833e9, 0x23)
	runtime/panic.go:1112 +0x72 fp=0xc00030fba8 sp=0xc00030fb78 pc=0x432a32
runtime.checkptrAlignment(0xc00031f018, 0x544800, 0x1)
	runtime/checkptr.go:18 +0xb7 fp=0xc00030fbd8 sp=0xc00030fba8 pc=0x4063a7
github.com/fsnotify/fsnotify.(*Watcher).readEvents(0xc0002900f0)
	github.com/fsnotify/fsnotify/inotify.go:275 +0x457 fp=0xc00031ffd8 sp=0xc00030fbd8 pc=0x519037
runtime.goexit()
	runtime/asm_amd64.s:1375 +0x1 fp=0xc00031ffe0 sp=0xc00031ffd8 pc=0x463eb1
created by github.com/fsnotify/fsnotify.NewWatcher
	github.com/fsnotify/fsnotify/inotify.go:59 +0x1a5
```

Fixes #330
tirmatovcl pushed a commit to cloudlinux/fsnotify that referenced this issue May 6, 2020
Fix the following unsafe pointer conversion found using the Go 1.14
-d=checkptr gcflags (`go1.14rc1 test -gcflags=all=-d=checkptr -v ./...`)

```
fatal error: checkptr: unsafe pointer conversion

goroutine 68 [running]:
runtime.throw(0x5833e9, 0x23)
	runtime/panic.go:1112 +0x72 fp=0xc00030fba8 sp=0xc00030fb78 pc=0x432a32
runtime.checkptrAlignment(0xc00031f018, 0x544800, 0x1)
	runtime/checkptr.go:18 +0xb7 fp=0xc00030fbd8 sp=0xc00030fba8 pc=0x4063a7
github.com/fsnotify/fsnotify.(*Watcher).readEvents(0xc0002900f0)
	github.com/fsnotify/fsnotify/inotify.go:275 +0x457 fp=0xc00031ffd8 sp=0xc00030fbd8 pc=0x519037
runtime.goexit()
	runtime/asm_amd64.s:1375 +0x1 fp=0xc00031ffe0 sp=0xc00031ffd8 pc=0x463eb1
created by github.com/fsnotify/fsnotify.NewWatcher
	github.com/fsnotify/fsnotify/inotify.go:59 +0x1a5
```

Fixes fsnotify#330
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants