From 2bd8e293982acc034554b7f66d6b969f24199876 Mon Sep 17 00:00:00 2001 From: "Andrew G. Morgan" Date: Tue, 10 Dec 2019 19:26:21 -0800 Subject: Realign around the evolving Go support for POSIX semantics syscalls. I've moved my go.patch to address: https://github.com/golang/go/issues/1435 into a development patch against the upstream Go sources: https://go-review.googlesource.com/c/go/+/210639/ and the review process will likely evolve it somewhat. I plan to ensure that working libcap/cap Go package is in sync with the working state of the above development change. As such, there is no need to keep the patch here any more. I'll keep the tests for now, as it isn't clear to me how the Go source tree supports tests that require privilege yet. Signed-off-by: Andrew G. Morgan --- go/cgo-required.sh | 10 +++++----- go/syscalls.sh | 19 +++++++------------ 2 files changed, 12 insertions(+), 17 deletions(-) (limited to 'go') diff --git a/go/cgo-required.sh b/go/cgo-required.sh index 8f22d43..5e7e98f 100755 --- a/go/cgo-required.sh +++ b/go/cgo-required.sh @@ -1,11 +1,11 @@ #!/bin/bash # -# Runtime check for whether or not syscall.PosixSyscall is available to -# the working go runtime or not. If it isn't we always have to use -# libcap/psx to get POSIX semantics for syscalls that change security -# state. +# Runtime check for whether or not syscall.PerOSThreadSyscall is +# available to the working go runtime or not. If it isn't we always +# have to use libcap/psx to get POSIX semantics for syscalls that +# change security state. -if [ -z "$(go doc syscall 2>/dev/null|grep PosixSyscall)" ]; then +if [ -z "$(go doc syscall 2>/dev/null|grep PerOSThreadSyscall)" ]; then echo "1" else echo "0" diff --git a/go/syscalls.sh b/go/syscalls.sh index eeba450..b91424d 100755 --- a/go/syscalls.sh +++ b/go/syscalls.sh @@ -6,14 +6,9 @@ if [[ -z "$dir" ]]; then exit 1 fi -# This is something that we should revisit if golang adopts my -# syscall.PosixSyscall patch. At that stage, we won't need cgo to -# support a pure Go program. However, we will need a to use the cgo -# version if the program being compiled actually needs cgo. That is, -# we should have two permenant files that use +build lines to control -# which one is built based on cgo or not. - -if [ -z "$(go doc syscall 2>/dev/null|grep PosixSyscall)" ]; then +# We use one or the other syscalls.go file based on whether or not the +# Go runtime include syscall.PerOSThreadSyscall or not. +if [ -z "$(go doc syscall 2>/dev/null|grep PerOSThreadSyscall)" ]; then rm -f "${dir}/syscalls_cgo.go" cat > "${dir}/syscalls.go" <