mirror of
https://github.com/netbirdio/netbird.git
synced 2025-07-31 20:00:34 +02:00
Disable pidfd check on Android 11 and below On Android 11 (SDK <= 30) and earlier, pidfd-related system calls are blocked by seccomp policies, causing SIGSYS crashes. This change overrides `checkPidfdOnce` to return an error on affected versions, preventing the use of unsupported pidfd features.
27 lines
591 B
Go
27 lines
591 B
Go
//go:build android
|
|
|
|
package android
|
|
|
|
import (
|
|
"fmt"
|
|
_ "unsafe"
|
|
)
|
|
|
|
// https://github.com/golang/go/pull/69543/commits/aad6b3b32c81795f86bc4a9e81aad94899daf520
|
|
// In Android version 11 and earlier, pidfd-related system calls
|
|
// are not allowed by the seccomp policy, which causes crashes due
|
|
// to SIGSYS signals.
|
|
|
|
//go:linkname checkPidfdOnce os.checkPidfdOnce
|
|
var checkPidfdOnce func() error
|
|
|
|
func execWorkaround(androidSDKVersion int) {
|
|
if androidSDKVersion > 30 { // above Android 11
|
|
return
|
|
}
|
|
|
|
checkPidfdOnce = func() error {
|
|
return fmt.Errorf("unsupported Android version")
|
|
}
|
|
}
|