From a5f474fc062a3b9140febc802b6cc38cbebdd973 Mon Sep 17 00:00:00 2001 From: dyhkwong Date: Sat, 28 Feb 2026 02:01:24 +0800 Subject: runtime: skip futex_time64 and timer_settime64 on 32-bit Android In Android versions 8.0-10 (API levels 26-29), futex_time64 and timer_settime64 are not in the allowlist of the seccomp filter and will lead to a runtime crash. Fixes #77621 Change-Id: I99607d7128c395edf93738440c2928b6819d8a21 Reviewed-on: https://go-review.googlesource.com/c/go/+/750040 LUCI-TryBot-Result: Go LUCI Reviewed-by: David Chase Auto-Submit: Jorropo Reviewed-by: Jorropo Reviewed-by: Michael Pratt --- src/runtime/os_linux32.go | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'src/runtime') diff --git a/src/runtime/os_linux32.go b/src/runtime/os_linux32.go index 16de6fb350..748fc53c3f 100644 --- a/src/runtime/os_linux32.go +++ b/src/runtime/os_linux32.go @@ -21,7 +21,12 @@ var isFutexTime32bitOnly atomic.Bool //go:nosplit func futex(addr unsafe.Pointer, op int32, val uint32, ts *timespec, addr2 unsafe.Pointer, val3 uint32) int32 { - if !isFutexTime32bitOnly.Load() { + // In Android versions 8.0-10 (API levels 26-29), futex_time64 + // is not in the allowlist of the seccomp filter and will lead to a + // runtime crash. See issue 77621. + // TODO: Check Android version and do not skip futex_time64 + // on Android 11 or higher (API level 30+). + if GOOS != "android" && !isFutexTime32bitOnly.Load() { ret := futex_time64(addr, op, val, ts, addr2, val3) // futex_time64 is only supported on Linux 5.0+ if ret != -_ENOSYS { @@ -49,7 +54,12 @@ var isSetTime32bitOnly atomic.Bool //go:nosplit func timer_settime(timerid int32, flags int32, new, old *itimerspec) int32 { - if !isSetTime32bitOnly.Load() { + // In Android versions 8.0-10 (API levels 26-29), timer_settime64 + // is not in the allowlist of the seccomp filter and will lead to a + // runtime crash. See issue 77621. + // TODO: Check Android version and do not skip timer_settime64 + // on Android 11 or higher (API level 30+). + if GOOS != "android" && !isSetTime32bitOnly.Load() { ret := timer_settime64(timerid, flags, new, old) // timer_settime64 is only supported on Linux 5.0+ if ret != -_ENOSYS { -- cgit v1.3