x/mobile: gomobile apps using syscall.Lstat() are blocked by seccomp on Android O and P #27797
Labels
FrozenDueToAge
mobile
Android, iOS, and x/mobile
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
What version of Go are you using (
go version
)?go version go1.11 linux/amd64
Does this issue reproduce with the latest release?
Yes, reproduced with go1.11 and go1.10.4
What operating system and processor architecture are you using (
go env
)?Android emulator API 26 to 28 (Android O and P) arch x86_64. The issue does not seem to occur on real Android devices (arch ARM).
What did you do?
Calling anything using
syscall.Lstat()
from the Go code.For example
ioutil.ReadDir()
,os.Rename
,os.RemoveAll
, ...What did you expect to see?
No crash
What did you see instead?
A crash due to Android seccomp filter:
This issue is quite similar to #20409 with
lstat(2)
instead ofselect(2)
:lstat(2)
is actually usingfstatat(2)
(https://android.googlesource.com/platform/bionic.git/+/master/libc/bionic/lstat.cpp)lstat(2)
, which is blocked by seccomp.Therefore, I think a similar fix would be to replace
lstat(2)
withfstatat(2)
in Golang.This seems to have been already done in https://golang.org/src/syscall/syscall_linux_arm64.go (line 47), this explains why the issue is not reproduced on real Android devices. But the issue still exists on emulators which uses the x86_64 architecture.
The text was updated successfully, but these errors were encountered: