0
0
mirror of https://github.com/termux/termux-packages.git synced 2025-07-15 18:54:49 +00:00
Files
termux-packages/packages/golang/patch-script/remove-pidfd.diff
okhex 4c621e62da bump(main/golang): 1.23.4 (#22817)
Drop obsolete comment regarding rc versions.
Drop use of a separate `_MAJOR_VERSION` variable as it is unused.
Co-authored-by: TomIO <43716232+TomJo2000@users.noreply.github.com>
2025-01-09 16:24:45 +01:00

90 lines
2.7 KiB
Diff

https://github.com/termux/termux-packages/issues/21265
https://github.com/golang/go/issues/69065
https://go-review.googlesource.com/c/go/+/608518
os: don't use pidfd functions on android
Reportedly the seccomp policy on at least some versions of
android/arm64 sends a SIGSYS signal on a call to pidfd_open.
Fixes #69065
Change-Id: Id8675ca6dc7193c2985cfbb11dd85206430e2f9d
diff --git a/src/os/export_linux_test.go b/src/os/export_linux_test.go
index 12434cb..da527f9 100644
--- a/src/os/export_linux_test.go
+++ b/src/os/export_linux_test.go
@@ -8,7 +8,6 @@ var (
PollCopyFileRangeP = &pollCopyFileRange
PollSpliceFile = &pollSplice
GetPollFDAndNetwork = getPollFDAndNetwork
- CheckPidfdOnce = checkPidfdOnce
)
const StatusDone = statusDone
diff --git a/src/os/export_pidfd_test.go b/src/os/export_pidfd_test.go
new file mode 100644
index 0000000..7705ddb
--- /dev/null
+++ b/src/os/export_pidfd_test.go
@@ -0,0 +1,9 @@
+// Copyright 2024 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+//go:build linux && !android
+
+package os
+
+var CheckPidfdOnce = checkPidfdOnce
diff --git a/src/os/pidfd_linux.go b/src/os/pidfd_linux.go
index 0bfef77..e3c6674 100644
--- a/src/os/pidfd_linux.go
+++ b/src/os/pidfd_linux.go
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build linux && !android
+
// Support for pidfd was added during the course of a few Linux releases:
// v5.1: pidfd_send_signal syscall;
// v5.2: CLONE_PIDFD flag for clone syscall;
@@ -12,6 +14,9 @@
// N.B. Alternative Linux implementations may not follow this ordering. e.g.,
// QEMU user mode 7.2 added pidfd_open, but CLONE_PIDFD was not added until
// 8.0.
+//
+// On Android systems the pidfd_open call reportedly triggers a SIGSYS signal,
+// (issue #69065), so don't use pidfd on Android.
package os
diff --git a/src/os/pidfd_linux_test.go b/src/os/pidfd_linux_test.go
index c1f41d0..f49ac81 100644
--- a/src/os/pidfd_linux_test.go
+++ b/src/os/pidfd_linux_test.go
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build linux && !android
+
package os_test
import (
diff --git a/src/os/pidfd_other.go b/src/os/pidfd_other.go
index ba9cbcb..78e09fb 100644
--- a/src/os/pidfd_other.go
+++ b/src/os/pidfd_other.go
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-//go:build (unix && !linux) || (js && wasm) || wasip1 || windows
+//go:build (unix && (android || !linux)) || (js && wasm) || wasip1 || windows
package os