-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Description
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (go version
)?
go version go1.10.1 darwin/amd64
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (go env
)?
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/johan/Library/Caches/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/johan/golang"
GORACE=""
GOROOT="/usr/local/Cellar/go/1.10.1/libexec"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.10.1/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/kq/3436m_v11sg0l7zqtmv2r1gw0000gn/T/go-build866177725=/tmp/go-build -gno-record-gcc-switches -fno-common"
What did you do?
Building a golang library for Android using gomobile bind
:
"$GOPATH/bin/gomobile" bind -target=android -tags="android" -v -o "$android_dest" "$package"
When the library is, calling os.Hostname()
, the call fails with error open /proc/sys/kernel/hostname: permission denied
run on Android O (8.1.0). Also tested on Marshmallow (6.0) where the problem didn't occur.
EDIT: Exact messsage is
04-05 15:43:10.178 5585-5585/? W/Thread-4: type=1400 audit(0.0:4585): avc: denied { read } for name="hostname" dev="proc" ino=3489882 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:proc:s0 tclass=file permissive=0
Looks like access to /proc
has been restricted? https://issuetracker.google.com/issues/37140047
What did you expect to see?
Call not failing.
What did you see instead?
App stopping with error
04-05 15:52:53.295 6990-6990/? W/Thread-4: type=1400 audit(0.0:4592): avc: denied { read } for name="hostname" dev="proc" ino=3515836 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:proc:s0 tclass=file permissive=0
04-05 15:52:53.313 1130-1570/? W/InputDispatcher: channel 'ee0d04c com.example.johan.lndtestapp2/com.example.johan.lndtestapp2.MainActivity (server)' ~ Consumer closed input channel or an error occurred. events=0x9
04-05 15:52:53.313 1130-1570/? E/InputDispatcher: channel 'ee0d04c com.example.johan.lndtestapp2/com.example.johan.lndtestapp2.MainActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
04-05 15:52:53.313 1130-2774/? I/ActivityManager: Process com.example.johan.lndtestapp2 (pid 6990) has died: fore TOP
04-05 15:52:53.313 1130-1170/? W/zygote64: kill(-6990, 9) failed: No such process
04-05 15:52:53.313 1130-1170/? I/zygote64: Successfully killed process cgroup uid 10179 pid 6990 in 0ms
04-05 15:52:53.314 1130-2774/? W/ActivityManager: Force removing ActivityRecord{2ba77ef u0 com.example.johan.lndtestapp2/.MainActivity t1949}: app died, no saved state
EDIT: my library wasn't handling the error case properly, so it is not actually crashing, just that the call to os.Hostname()
is failing.