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

runtime: use tgkill instead of tkill to keep Android happy #24924

Closed
zx2c4 opened this issue Apr 18, 2018 · 3 comments

Comments

Projects
None yet
4 participants
@zx2c4
Copy link
Contributor

commented Apr 18, 2018

Go uses tkill in the panic routine. From the tkill man page:

   tkill() is an obsolete predecessor to
   tgkill().   It allows only the target
   thread ID to be specified, which  may
   result in the wrong thread being sig‐
   naled if a thread terminates and  its
   thread  ID  is recycled.  Avoid using
   this system call.

Android sets a seccomp filter that disallows tkill but allows tgkill. Therefore the solution is to switch Go to using tgkill. According to the man page, there are other good reasons for switching to tgkill too.

This is similar to #23750 but is yet-another mole.

@ianlancetaylor ianlancetaylor added this to the Go1.11 milestone Apr 18, 2018

@ianlancetaylor ianlancetaylor changed the title Crash on Android: `tkill` isn't allowed by seccomp runtime: use tgkill instead of tkill to keep Android happy Apr 18, 2018

@ianlancetaylor

This comment has been minimized.

Copy link
Contributor

commented Apr 18, 2018

@eliasnaur

This comment has been minimized.

Copy link
Contributor

commented Apr 18, 2018

I have no objection to tgkill if it's better, but I do see tkill listed in the seccomp list from 23750:

https://android.googlesource.com/platform/bionic/+/master/libc/seccomp/arm64_app_policy.cpp

Do you have a small test case that breaks Android O?

@zx2c4

This comment has been minimized.

Copy link
Contributor Author

commented Apr 18, 2018

Woah, actually, no, I can't reproduce in any of the emulators on any of the architectures. I sent this based on crash logs from some users who might be running strange/old/weirdvendor devices.

So, fine to close this issue.

Sorry for the noise.

@zx2c4 zx2c4 closed this Apr 18, 2018

@golang golang locked and limited conversation to collaborators Apr 18, 2019

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.