-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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/mobile/app: cannot open /proc/self/auxv: Permission denied #9229
Comments
Ah, yes. It does not work on some platforms some of the time, as noted here: /* IMPORTANT:
I'll try and find another way. |
The Go runtime needs the following items from AUXV on linux:
For Android/ARM port, I think the way to go is to make mobile/app synthesize the needed auxv entries.
Of course, the _AT_HWCAP set here is the bare minimum needed by the Go runtime. Ideally, we should translate as many bits of android cpufeatures to hwcaps as possible. I'm not sure how to deal with _AT_SYSINFO and _AT_SYSINFO_EHDR yet, but in the worse case we simply pass 0 and let the runtime fallback to int 0x80/syscall. |
Yep, I've already got a patch synthesizing auxv for arm, it's easy enough. Interestingly it seems to work, and then panic randomly later in my program in debug mode, when it usually passes when reading from /proc/self/auxv. I've verified with printstring that everythin in os_linux_arm.go is getting the right value, so it must be something else. Still investigating. x86/amd64 is a problem for another day. First up is getting the builder working in debug mode. |
I assume platform init is handled by bionic before the Go runtime inits. If so, can we use getauxval from libc (or even just use __libc_auxv directly)? |
bionic is a minimal libc. While there is a getauxval (and __libc_auxv!), it is private: https://android.googlesource.com/platform/bionic.git/+/master/libc/private/bionic_auxv.h This means it is not exported in the supported .h files that ship with the NDK and its use is strongly discouraged by the android team. I have agreed not to use any private interfaces in our Go packages. |
You're right, __libc_auxv is definitely private. But getauxval is in sys/auxv.h. Surely that's not off limits? Or is that excluded by the NDK? (Sorry, I know the libc side of this, but not the NDK side.) |
So it does! It shipped in android-21, and I was grepping over an older version. (My method for determining what's private or not is to search all the headers that ship with the NDK, and I usually stick to android-9.) I don't want to introduce a dependency on the latest release yet, but we should switch to it eventually. |
Fixed (at least for now) in golang/mobile@32030f7. Looks like commits to other Go repositories does not close issues here. |
@crawshaw, to refer to an issue in another repo, you need to use the See https://help.github.com/articles/closing-issues-via-commit-messages/ for full details. |
When debug apk is built all works fine, but in release mode /proc/self/auxv is not readable and app crashes.
go version 1.4rc2 linux/amd64
The text was updated successfully, but these errors were encountered: