Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
observer_stats: use GetNumPossibleCPUs()
runtime.NumCPU() returns the number of CPUs available to the process. This excludes offline CPUs, but also does not take into acount task CPU affinity. For example: ``` $ cat numcpus.go package main import ( "fmt" "runtime" ) func main() { fmt.Printf("%d\n", runtime.NumCPU()) } $ go run numcpus.go 16 $ taskset --cpu-list 0 go run numcpus.go 1 ``` This leads to memory corruption because we pass to the bpf() call a buffer smaller than the write it will perform, leading to data being overwritten. Reducing the timeout of the goroutine that reads stat maps will reproduce this quickly and lead to SIGSEGVs, corrupted prometheus metrics or other symptoms. Signed-off-by: Kornilios Kourtis <[email protected]>
- Loading branch information