frida-java-bridge 6.3.3 → 6.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/android.js +35 -16
- package/package.json +1 -1
package/lib/android.js
CHANGED
|
@@ -187,7 +187,11 @@ function _getApi () {
|
|
|
187
187
|
},
|
|
188
188
|
// Android >= 6
|
|
189
189
|
_ZN3art9JavaVMExt12DecodeGlobalEPNS_6ThreadEPv: ['art::JavaVMExt::DecodeGlobal', 'pointer', ['pointer', 'pointer', 'pointer']],
|
|
190
|
-
|
|
190
|
+
|
|
191
|
+
// makeDecodeGlobalFallback() uses:
|
|
192
|
+
// Android >= 15
|
|
193
|
+
_ZNK3art6Thread19DecodeGlobalJObjectEP8_jobject: ['art::Thread::DecodeJObject', 'pointer', ['pointer', 'pointer']],
|
|
194
|
+
// Android < 6
|
|
191
195
|
_ZNK3art6Thread13DecodeJObjectEP8_jobject: ['art::Thread::DecodeJObject', 'pointer', ['pointer', 'pointer']],
|
|
192
196
|
|
|
193
197
|
// Android >= 6
|
|
@@ -314,6 +318,7 @@ function _getApi () {
|
|
|
314
318
|
'_ZN3art9JavaVMExt12AddGlobalRefEPNS_6ThreadEPNS_6mirror6ObjectE',
|
|
315
319
|
'_ZN3art9JavaVMExt12DecodeGlobalEPv',
|
|
316
320
|
'_ZN3art9JavaVMExt12DecodeGlobalEPNS_6ThreadEPv',
|
|
321
|
+
'_ZNK3art6Thread19DecodeGlobalJObjectEP8_jobject',
|
|
317
322
|
'_ZNK3art6Thread13DecodeJObjectEP8_jobject',
|
|
318
323
|
'_ZN3art10ThreadList10SuspendAllEPKcb',
|
|
319
324
|
'_ZN3art10ThreadList10SuspendAllEv',
|
|
@@ -489,7 +494,7 @@ function _getApi () {
|
|
|
489
494
|
temporaryApi['art::JavaVMExt::AddGlobalRef'] = makeAddGlobalRefFallbackForAndroid5(temporaryApi);
|
|
490
495
|
}
|
|
491
496
|
if (temporaryApi['art::JavaVMExt::DecodeGlobal'] === undefined) {
|
|
492
|
-
temporaryApi['art::JavaVMExt::DecodeGlobal'] =
|
|
497
|
+
temporaryApi['art::JavaVMExt::DecodeGlobal'] = makeDecodeGlobalFallback(temporaryApi);
|
|
493
498
|
}
|
|
494
499
|
if (temporaryApi['art::ArtMethod::PrettyMethod'] === undefined) {
|
|
495
500
|
temporaryApi['art::ArtMethod::PrettyMethod'] = temporaryApi['art::ArtMethod::PrettyMethodNullSafe'];
|
|
@@ -618,6 +623,7 @@ function _getArtRuntimeSpec (api) {
|
|
|
618
623
|
|
|
619
624
|
const apiLevel = getAndroidApiLevel();
|
|
620
625
|
const codename = getAndroidCodename();
|
|
626
|
+
const isApiLevel34OrApexEquivalent = Module.findExportByName('libart.so', '_ZN3art7AppInfo29GetPrimaryApkReferenceProfileEv') !== null;
|
|
621
627
|
|
|
622
628
|
let spec = null;
|
|
623
629
|
|
|
@@ -645,7 +651,7 @@ function _getArtRuntimeSpec (api) {
|
|
|
645
651
|
const threadListOffset = internTableOffset - pointerSize;
|
|
646
652
|
|
|
647
653
|
let heapOffset;
|
|
648
|
-
if (
|
|
654
|
+
if (isApiLevel34OrApexEquivalent) {
|
|
649
655
|
heapOffset = threadListOffset - (9 * pointerSize);
|
|
650
656
|
} else if (apiLevel >= 24) {
|
|
651
657
|
heapOffset = threadListOffset - (8 * pointerSize);
|
|
@@ -1807,6 +1813,9 @@ on_leave_gc_concurrent_copying_copying_phase (GumInvocationContext * ic)
|
|
|
1807
1813
|
Gc: {
|
|
1808
1814
|
copyingPhase: {
|
|
1809
1815
|
onLeave: cm.on_leave_gc_concurrent_copying_copying_phase
|
|
1816
|
+
},
|
|
1817
|
+
runFlip: {
|
|
1818
|
+
onEnter: cm.on_leave_gc_concurrent_copying_copying_phase
|
|
1810
1819
|
}
|
|
1811
1820
|
}
|
|
1812
1821
|
}
|
|
@@ -1884,19 +1893,22 @@ function ensureArtKnowsHowToHandleReplacementMethods (vm) {
|
|
|
1884
1893
|
|
|
1885
1894
|
const apiLevel = getAndroidApiLevel();
|
|
1886
1895
|
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
exportName = '_ZN3art2gc9collector17ConcurrentCopying12MarkingPhaseEv';
|
|
1892
|
-
}
|
|
1893
|
-
|
|
1894
|
-
if (exportName !== null) {
|
|
1895
|
-
Interceptor.attach(Module.getExportByName('libart.so', exportName), artController.hooks.Gc.copyingPhase);
|
|
1896
|
+
const mayUseCollector = (apiLevel > 28)
|
|
1897
|
+
? new NativeFunction(Module.getExportByName('libart.so', '_ZNK3art2gc4Heap15MayUseCollectorENS0_13CollectorTypeE'), 'bool', ['pointer', 'int'])
|
|
1898
|
+
: () => false;
|
|
1899
|
+
const kCollectorTypeCMC = 3;
|
|
1896
1900
|
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1901
|
+
if (mayUseCollector(getApi().artHeap, kCollectorTypeCMC)) {
|
|
1902
|
+
Interceptor.attach(Module.getExportByName('libart.so', '_ZN3art6Thread15RunFlipFunctionEPS0_b'), artController.hooks.Gc.runFlip);
|
|
1903
|
+
} else {
|
|
1904
|
+
let exportName = null;
|
|
1905
|
+
if (apiLevel > 28) {
|
|
1906
|
+
exportName = '_ZN3art2gc9collector17ConcurrentCopying12CopyingPhaseEv';
|
|
1907
|
+
} else if (apiLevel > 22) {
|
|
1908
|
+
exportName = '_ZN3art2gc9collector17ConcurrentCopying12MarkingPhaseEv';
|
|
1909
|
+
}
|
|
1910
|
+
if (exportName !== null) {
|
|
1911
|
+
Interceptor.attach(Module.getExportByName('libart.so', exportName), artController.hooks.Gc.copyingPhase);
|
|
1900
1912
|
}
|
|
1901
1913
|
}
|
|
1902
1914
|
}
|
|
@@ -3841,8 +3853,15 @@ function makeAddGlobalRefFallbackForAndroid5 (api) {
|
|
|
3841
3853
|
};
|
|
3842
3854
|
}
|
|
3843
3855
|
|
|
3844
|
-
function
|
|
3856
|
+
function makeDecodeGlobalFallback (api) {
|
|
3857
|
+
/*
|
|
3858
|
+
* Fallback for art::JavaVMExt::DecodeGlobal, which is
|
|
3859
|
+
* unavailable in Android versions <= 5 and >= 15.
|
|
3860
|
+
*/
|
|
3845
3861
|
const decode = api['art::Thread::DecodeJObject'];
|
|
3862
|
+
if (decode === undefined) {
|
|
3863
|
+
throw new Error('art::Thread::DecodeJObject is not available; please file a bug');
|
|
3864
|
+
}
|
|
3846
3865
|
|
|
3847
3866
|
return function (vm, thread, ref) {
|
|
3848
3867
|
return decode(thread, ref);
|