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

Fix crash on HTC One M8 #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ahamilt
Copy link

@ahamilt ahamilt commented Nov 17, 2016

There appears to be a bug on the HTC One M8, described here:

https://code.google.com/p/android/issues/detail?id=190058

Calls to methods on Annotations attempt to read parmaeters that
should not be there, resulting in "use of invalid jobject" error.
This affects libnatj.so, when NatJ.register() is called
the process crashes. Extract from log included below.

This bug looks like it is fixed in ASOP, but unfortunately
not in the HTC ROM (tested with the latest OTA ROM
available on this device, 6.12.161.4. Later firmware
versions are available from different carriers and for
manual download / install, I have not tested these).

The workaround described in the issue above prevents the crash.
This commit applies the workaround to CRuntime.cpp.

11-17 09:32:28.434 28187-28187/myapplication.dev A/art:
art/runtime/java_vm_ext.cc:448] JNI DETECTED ERROR IN APPLICATION: use
of invalid jobject 0xb38d2070
11-17 09:32:28.434 28187-28187/myapplication.dev A/art:
art/runtime/java_vm_ext.cc:448] from void
org.moe.natj.c.CRuntime.registerClass(java.lang.Class)
...
11-17 09:32:28.435 28187-28187/myapplication.dev A/art:
art/runtime/java_vm_ext.cc:448] native: #9 pc 0000acb1
/data/app/myapplication.dev-1/lib/arm/libnatj.so
(_JNIEnv::CallObjectMethod(_jobject*, _jmethodID*, ...)+28)
11-17 09:32:28.435 28187-28187/myapplication.dev A/art:
art/runtime/java_vm_ext.cc:448] native: #10 pc 0000e0ef
/data/app/myapplication.dev-1/lib/arm/libnatj.so
(processStructureFunctions(_JNIEnv*, _jclass*)+814)

There appears to be a bug on the HTC One M8, described here:

https://code.google.com/p/android/issues/detail?id=190058

Calls to methods on Annotations attempt to read parmaeters that
should not be there, resulting in "use of invalid jobject" error.
This affects libnatj.so, when NatJ.register() is called
the process crashes. Extract from log included below.

This bug looks like it is fixed in ASOP, but unfortunately
not in the HTC ROM (tested with the latest OTA ROM
available on this device, 6.12.161.4. Later firmware
versions are available from different carriers and for
manual download / install, I have not tested these).

The workaround described in the issue above prevents the crash.
This commit applies the workaround to CRuntime.cpp.

11-17 09:32:28.434 28187-28187/myapplication.dev A/art:
art/runtime/java_vm_ext.cc:448] JNI DETECTED ERROR IN APPLICATION: use
of invalid jobject 0xb38d2070
11-17 09:32:28.434 28187-28187/myapplication.dev A/art:
art/runtime/java_vm_ext.cc:448]     from void
org.moe.natj.c.CRuntime.registerClass(java.lang.Class)
...
11-17 09:32:28.435 28187-28187/myapplication.dev A/art:
art/runtime/java_vm_ext.cc:448]   native: multi-os-engine#9 pc 0000acb1
/data/app/myapplication.dev-1/lib/arm/libnatj.so
(_JNIEnv::CallObjectMethod(_jobject*, _jmethodID*, ...)+28)
11-17 09:32:28.435 28187-28187/myapplication.dev A/art:
art/runtime/java_vm_ext.cc:448]   native: multi-os-engine#10 pc 0000e0ef
/data/app/myapplication.dev-1/lib/arm/libnatj.so
(processStructureFunctions(_JNIEnv*, _jclass*)+814)
@kisg
Copy link
Contributor

kisg commented Nov 23, 2016

First, I would like to thank you for taking the time creating this pull request.

However, I am not sure if we should add this workaround, because it may break other VMs, e.g. Oracle VM.

I would like to see a solution where the workaround is only applied if the buggy ART runtime is detected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants