Skip to content

runtime: go of nil func value crashes #8045

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

Closed
dvyukov opened this issue May 20, 2014 · 3 comments
Closed

runtime: go of nil func value crashes #8045

dvyukov opened this issue May 20, 2014 · 3 comments
Milestone

Comments

@dvyukov
Copy link
Member

dvyukov commented May 20, 2014

go version devel +4a839bf01b58 Tue May 20 15:52:08 2014 +1000 linux/amd64

The program is:

package main
func main() {
    var f func()
    go f()
    select{}
}

Currently it crashes with:

        fatal error: unexpected signal during runtime execution
        [signal 0xb code=0x1 addr=0x0 pc=0x417e77]
        
        goroutine 16 [running]:
        runtime.throw(0x4561c5)
            src/pkg/runtime/panic.c:520 +0x69 fp=0x7ff05514de78
        runtime.sigpanic()
            src/pkg/runtime/os_linux.c:222 +0x3d fp=0x7ff05514de90
        runtime.gostartcallfn(0xc2080025c8, 0x0)
            src/pkg/runtime/stack.c:847 +0x27 fp=0x7ff05514deb0
        runtime.newproc1(0x0, 0x7ff05514df38, 0x0, 0x400c38)
            src/pkg/runtime/proc.c:1852 +0x137 fp=0x7ff05514def0
        runtime.newproc(0x0, 0x0)
            src/pkg/runtime/proc.c:1803 +0x53 fp=0x7ff05514df28
        main.main()
            /tmp/go-build923308582/main.go:9 +0x38 fp=0x7ff05514df50
        runtime.main()
            src/pkg/runtime/proc.c:247 +0x11a fp=0x7ff05514dfa8

This happens because runtime.gostartcallfn dereferences nil with m->locks>0.
This causes unrecoverable fatal error. The program must panic instead.
@gopherbot
Copy link
Contributor

Comment 1:

CL https://golang.org/cl/97620043 mentions this issue.

@randall77
Copy link
Contributor

Comment 2:

issue #8047 is related.

@dvyukov
Copy link
Member Author

dvyukov commented May 28, 2014

Comment 3:

This issue was closed by revision b5caa02.

Status changed to Fixed.

@rsc rsc added this to the Go1.3 milestone Apr 14, 2015
@golang golang locked and limited conversation to collaborators Jun 25, 2016
wheatman pushed a commit to wheatman/go-akaros that referenced this issue Jun 25, 2018
Currently runtime derefences nil with m->locks>0,
which causes unrecoverable fatal error.
Panic instead.
Fixes golang#8045.

LGTM=rsc
R=golang-codereviews, rsc
CC=golang-codereviews, khr
https://golang.org/cl/97620043
This issue was closed.
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

4 participants