Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/sys/unix: Android x86_64 emulator crashes when using the pipe syscall #40828

Closed
cmcewen opened this issue Aug 16, 2020 · 5 comments
Closed
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

Comments

@cmcewen
Copy link

cmcewen commented Aug 16, 2020

What version of Go are you using (go version)?

$ go version
go version go1.13.15 darwin/amd64

I am using gomobile to compile a library to run on Android

Does this issue reproduce with the latest release?

Yes - it is an issue in golang.org/x/sys

What operating system and processor architecture are you using (go env)?

I am running a library compiled with gomobile running on the AOSP API 29 x86_64 emulator

What did you do?

Ran the app and called the library

What did you expect to see?

The app run fine

What did you see instead?

The app crashed:

08-10 17:54:49.398  5047  5047 F DEBUG   : Revision: '0'
08-10 17:54:49.398  5047  5047 F DEBUG   : ABI: 'x86_64'
08-10 17:54:49.398  5047  5047 F DEBUG   : pid: 4938, tid: 4958, name: XXXXX
08-10 17:54:49.398  5047  5047 F DEBUG   : signal 31 (SIGSYS), code 1 (SYS_SECCOMP), fault addr --------
08-10 17:54:49.398  5047  5047 F DEBUG   : Cause: seccomp prevented call to disallowed x86_64 system call 22

Using strace I was able to track it down to pipe:
9930 rt_tgsigqueueinfo(9900, 9930, SIGSYS, {si_signo=SIGSYS, si_code=SYS_SECCOMP, si_call_addr=0x7d49d5a145a6, si_syscall=__NR_pipe, si_arch=AUDIT_ARCH_X86_64}) = 0

@tklauser tklauser changed the title Android x86_64 emulator crashes when using the pipe syscall - golang.org/x/sys x/sys/unix: Android x86_64 emulator crashes when using the pipe syscall Aug 17, 2020
@gopherbot gopherbot added this to the Unreleased milestone Aug 17, 2020
@dmitshur dmitshur added 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. labels Aug 18, 2020
@dmitshur
Copy link
Contributor

@ianlancetaylor
Copy link
Contributor

Do you see the same problem if you call syscall.Pipe? Seems to me that you would, but it would be nice to check. Thanks.

@cmcewen
Copy link
Author

cmcewen commented Nov 18, 2020

This PR was able to fix the crash for me: golang/sys#75

@gopherbot
Copy link

Change https://golang.org/cl/350530 mentions this issue: syscall: implement Pipe using pipe2 syscall on all linux platforms

@gopherbot
Copy link

Change https://golang.org/cl/350549 mentions this issue: unix: implement Pipe using pipe2 syscall on all linux platforms

gopherbot pushed a commit that referenced this issue Sep 17, 2021
Most architectures currently already implement Pipe using the pipe2
syscall. Only 386, amd64 and mips{,le} still use the pipe syscall.
However, some systems (e.g. Android seccomp policies) block that
syscall, see #40828 for an example.

The pipe2 syscall was added in Linux kernel version 2.6.27. The minimum
required Linux kernel version for Go 1.18 will be changed to 2.6.32
per #45964 so it is possible to unify the implementation of Pipe using
the pipe2 syscall.

For #45964

Change-Id: I8ed6a391300c95f3107b4ec6b27d320e42fb535b
Reviewed-on: https://go-review.googlesource.com/c/go/+/350530
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
@golang golang locked and limited conversation to collaborators Sep 17, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
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.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants