From dec2b4c83dd8b86b56e901f832819e76ff6969df Mon Sep 17 00:00:00 2001 From: Cuong Manh Le Date: Mon, 27 Oct 2025 16:47:20 +0700 Subject: [PATCH] runtime: avoid bound check in freebsd binuptime Fixes #76062 Change-Id: I683c1232aaeac12b0b3688472bb277adb95ad542 Reviewed-on: https://go-review.googlesource.com/c/go/+/715180 Reviewed-by: Keith Randall Auto-Submit: Cuong Manh Le LUCI-TryBot-Result: Go LUCI Reviewed-by: Keith Randall Reviewed-by: Michael Knyszek Reviewed-by: Meng Zhuo --- src/runtime/vdso_freebsd.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/runtime/vdso_freebsd.go b/src/runtime/vdso_freebsd.go index feecada0357..99ca1571a7a 100644 --- a/src/runtime/vdso_freebsd.go +++ b/src/runtime/vdso_freebsd.go @@ -54,6 +54,9 @@ func binuptime(abs bool) (bt bintime) { } curr := atomic.Load(&timekeepSharedPage.current) // atomic_load_acq_32 + if curr >= uint32(len(timehands)) { + return zeroBintime + } th := &timehands[curr] gen := atomic.Load(&th.gen) // atomic_load_acq_32 bt = th.offset