gvisor
gvisor copied to clipboard
pkg/cpuid: logs about Linux-specific /proc/cpuinfo missing on macOS
Description
There a init-time parse of /proc/cpuinfo which isn't conditional on the GOOS.
macOS doesn't have that file, so it shouldn't log a warning about it:
https://github.com/google/gvisor/blob/d9c66eb76971ea54849c6a2166e1aad91d6f6050/pkg/cpuid/native_arm64.go#L49
This is a regression from some recent-ish refactor. I haven't yet hunted it down.
Steps to reproduce
No response
runsc version
n/a
docker version (if using docker)
n/a
uname
macOS
kubectl (if using Kubernetes)
n/a
repo state (if built from source)
Bug exists at HEAD (f857f268eceb1cdee0b2bdfa218c969c84033fcd)
runsc debug logs (if available)
No response
Minimal repro demo:
bradfitz@book1pro gvisor_repro % cat foo.go
package main
import (
"fmt"
_ "gvisor.dev/gvisor/pkg/cpuid"
)
func main() {
fmt.Println("hi")
}
bradfitz@book1pro gvisor_repro % go run foo.go
W0731 08:27:20.214213 87353 native_arm64.go:52] Could not read /proc/cpuinfo: open /proc/cpuinfo: no such file or directory
W0731 08:27:20.214329 87353 native_arm64.go:177] Could not read /proc/self/auxv: open /proc/self/auxv: no such file or directory
hi
bradfitz@book1pro gvisor_repro %
Could you just use https://pkg.go.dev/golang.org/x/sys/cpu instead? At least on darwin?
/cc @dsnet
I sent https://github.com/google/gvisor/pull/7850 as a proposed workaround for now.
/cc @ayushr2 @kevinGC
Seems this has been fixed?