From: Cuong Manh Le Date: Mon, 27 Oct 2025 09:47:20 +0000 (+0700) Subject: runtime: avoid bound check in freebsd binuptime X-Git-Tag: go1.26rc1~460 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=dec2b4c83d;p=gostls13.git 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 --- diff --git a/src/runtime/vdso_freebsd.go b/src/runtime/vdso_freebsd.go index feecada035..99ca1571a7 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