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

cmd/go: panic in cmd/go/internal/cache.(*DiskCache).markUsed #70600

Closed
FiloSottile opened this issue Nov 27, 2024 · 7 comments
Closed

cmd/go: panic in cmd/go/internal/cache.(*DiskCache).markUsed #70600

FiloSottile opened this issue Nov 27, 2024 · 7 comments
Labels
NeedsFix The path to resolution is known, but the work has not been done. release-blocker
Milestone

Comments

@FiloSottile
Copy link
Contributor

Go version

go version devel go1.24-733df2bc0a Mon Nov 25 02:23:41 2024 +0000 darwin/arm64

Output of go env in your module/workspace:

GONOPROXY='github.com/FiloSottile/*,filippo.io/*'
GOPROXY='https://proxy.golang.org'

What did you do?

$ go test crypto/internal/fips140/bigmod

What did you see happen?

Tests run.

What did you expect to see?

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x18 pc=0x104b03b30]

goroutine 690 [running]:
cmd/go/internal/cache.(*DiskCache).markUsed(0x1400000c2d0, {0x140009860e0, 0x6c})
	/Users/filippo/go/src/cmd/go/internal/cache/cache.go:366 +0xf0
cmd/go/internal/cache.(*DiskCache).OutputFile(0x1400000c2d0, {0xc9, 0xe6, 0x6, 0xd0, 0x4, 0xcc, 0x52, 0xdc, 0x1c, ...})
	/Users/filippo/go/src/cmd/go/internal/cache/cache.go:317 +0x58
cmd/go/internal/cache.GetFile({0x105102cc0, 0x1400000c2d0}, {0x69, 0xec, 0x92, 0x5b, 0xa7, 0x87, 0x5, 0x8e, ...})
	/Users/filippo/go/src/cmd/go/internal/cache/cache.go:270 +0xc4
cmd/go/internal/work.(*Builder).vet(0x14000278480, {0x23?, 0x0?}, 0x1400018f4a0)
	/Users/filippo/go/src/cmd/go/internal/work/exec.go:1329 +0x5bc
cmd/go/internal/work.ActorFunc.Act(0x1051023a0?, 0x1055150c0?, {0x1051023a0?, 0x1055150c0?}, 0x140000abf88?)
	/Users/filippo/go/src/cmd/go/internal/work/action.go:76 +0x3c
cmd/go/internal/work.(*Builder).Do.func3({0x1051023a0, 0x1055150c0}, 0x1400018f4a0)
	/Users/filippo/go/src/cmd/go/internal/work/exec.go:153 +0x710
cmd/go/internal/work.(*Builder).Do.func4()
	/Users/filippo/go/src/cmd/go/internal/work/exec.go:225 +0x94
created by cmd/go/internal/work.(*Builder).Do in goroutine 1
	/Users/filippo/go/src/cmd/go/internal/work/exec.go:211 +0x308
@FiloSottile
Copy link
Contributor Author

I needed to make progress so I emptied GOCACHE, which solved the issue. I kept a copy of the old one if you need.

@rolandshoemaker
Copy link
Member

cc @matloob, possibly related to the #69290 work.

@GoVeronicaGo GoVeronicaGo added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Nov 27, 2024
@matloob matloob added NeedsFix The path to resolution is known, but the work has not been done. release-blocker and removed NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels Dec 3, 2024
@matloob matloob added this to the Go1.24 milestone Dec 3, 2024
@adonovan
Copy link
Member

adonovan commented Dec 3, 2024

I'm hitting this too, reproducibly. There's a missing err==nil check before using info in this code:

// markUsed reports whether the file is a directory (an executable cache entry).
func (c *DiskCache) markUsed(file string) (isExecutable bool) {
	info, err := os.Stat(file)
	if err == nil && c.now().Sub(info.ModTime()) < mtimeInterval {
		return info.IsDir()
	}
	os.Chtimes(file, c.now(), c.now())
	return info.IsDir()
}

@gopherbot
Copy link
Contributor

Change https://go.dev/cl/633037 mentions this issue: cmd/go/internal/cache: always check error from stat in markUsed

@mknyszek
Copy link
Contributor

mknyszek commented Dec 4, 2024

RC1 is currently planned for next week. Is this OK to land after the RC, or does it block the RC? If it blocks the RC, we should prioritize moving the fix forward. Thanks.

@adonovan
Copy link
Member

adonovan commented Dec 4, 2024

This fix should definitely be in the RC.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsFix The path to resolution is known, but the work has not been done. release-blocker
Projects
None yet
Development

No branches or pull requests

8 participants