testwhat / SmaliEx

A wrapper to get de-optimized dex from odex/oat/vdex.
532 stars 141 forks source link

MarshMallow Nexus 5 boot.oat #7

Closed pipop62 closed 8 years ago

pipop62 commented 9 years ago

Hello, thank you very much for your work. I understand MM just dropped but i want to report two issues anyway. Tested over Nexus 5 MarshMallow official MRA58K boot.oat. Thank you very very much in advance, used your tool successfully for the whole Lollipop year.

First one:

10-05 20:37:10:735 De-optimizing /system/framework/core-libart.jar 10-05 20:37:11:305 Analysis info of Landroid/icu/impl/PluralRulesLoader; : : Unresolved INVOKE_VIRTUAL_QUICK_ART mIdx=16 objReg=3, use Ljava/lang/String; to invoke (it may have exception but is expected)

Second one:

10-05 20:37:21:161 De-optimizing /system/framework/telephony-common.jar 10-05 20:37:21:490 Analysis info of Lcom/android/internal/telephony/cdma/CdmaServiceStateTracker; : dump: Near .line 2075 UnresolvedOdexInstruction IGET_BOOLEAN_QUICK_ART Format22cs i=86 UnresolvedOdexInstruction INVOKE_VIRTUAL_QUICK_ART Format35ms i=87 UnresolvedOdexInstruction INVOKE_VIRTUAL_QUICK_ART Format35ms i=89 UnresolvedOdexInstruction INVOKE_VIRTUAL_QUICK_ART Format35ms i=91 UnresolvedOdexInstruction INVOKE_VIRTUAL_QUICK_ART Format35ms i=95 UnresolvedOdexInstruction IGET_QUICK_ART Format22cs i=97 UnresolvedOdexInstruction INVOKE_VIRTUAL_QUICK_ART Format35ms i=98 UnresolvedOdexInstruction INVOKE_VIRTUAL_QUICK_ART Format35ms i=100 UnresolvedOdexInstruction INVOKE_VIRTUAL_QUICK_ART Format35ms i=102 UnresolvedOdexInstruction INVOKE_VIRTUAL_QUICK_ART Format35ms i=106 UnresolvedOdexInstruction IGET_QUICK_ART Format22cs i=108 UnresolvedOdexInstruction INVOKE_VIRTUAL_QUICK_ART Format35ms i=109 UnresolvedOdexInstruction INVOKE_VIRTUAL_QUICK_ART Format35ms i=111 UnresolvedOdexInstruction INVOKE_VIRTUAL_QUICK_ART Format35ms i=113 UnresolvedOdexInstruction INVOKE_VIRTUAL_QUICK_ART Format35ms i=117 UnresolvedOdexInstruction IGET_BOOLEAN_QUICK_ART Format22cs i=119 UnresolvedOdexInstruction INVOKE_VIRTUAL_QUICK_ART Format35ms i=120 UnresolvedOdexInstruction INVOKE_VIRTUAL_QUICK_ART Format35ms i=122 UnresolvedOdexInstruction INVOKE_VIRTUAL_QUICK_ART Format35ms i=124 UnresolvedOdexInstruction INVOKE_VIRTUAL_QUICK_ART Format35ms i=125 UnresolvedOdexInstruction INVOKE_VIRTUAL_QUICK_ART Format35ms i=129 UnresolvedOdexInstruction IGET_QUICK_ART Format22cs i=131 UnresolvedOdexInstruction INVOKE_VIRTUAL_QUICK_ART Format35ms i=132 UnresolvedOdexInstruction INVOKE_VIRTUAL_QUICK_ART Format35ms i=134 UnresolvedOdexInstruction INVOKE_VIRTUAL_QUICK_ART Format35ms i=136 UnresolvedOdexInstruction INVOKE_VIRTUAL_QUICK_ART Format35ms i=140 UnresolvedOdexInstruction IGET_BOOLEAN_QUICK_ART Format22cs i=142 UnresolvedOdexInstruction INVOKE_VIRTUAL_QUICK_ART Format35ms i=143 UnresolvedOdexInstruction INVOKE_VIRTUAL_QUICK_ART Format35ms i=145 UnresolvedOdexInstruction INVOKE_VIRTUAL_QUICK_ART Format35ms i=147 UnresolvedOdexInstruction INVOKE_VIRTUAL_QUICK_ART Format35ms i=151 UnresolvedOdexInstruction IGET_WIDE_QUICK_ART Format22cs i=153 UnresolvedOdexInstruction INVOKE_VIRTUAL_QUICK_ART Format35ms i=154 UnresolvedOdexInstruction INVOKE_VIRTUAL_QUICK_ART Format35ms i=156 UnresolvedOdexInstruction INVOKE_VIRTUAL_QUICK_ART Format35ms i=158 UnresolvedOdexInstruction INVOKE_VIRTUAL_QUICK_ART Format35ms i=162 UnresolvedOdexInstruction IGET_BOOLEAN_QUICK_ART Format22cs i=164 UnresolvedOdexInstruction INVOKE_VIRTUAL_QUICK_ART Format35ms i=165 UnresolvedOdexInstruction INVOKE_VIRTUAL_QUICK_ART Format35ms i=167 UnresolvedOdexInstruction INVOKE_VIRTUAL_QUICK_ART Format35ms i=169 UnresolvedOdexInstruction INVOKE_VIRTUAL_QUICK_ART Format35ms i=173 UnresolvedOdexInstruction IGET_OBJECT_QUICK_ART Format22cs i=175 UnresolvedOdexInstruction INVOKE_VIRTUAL_QUICK_ART Format35ms i=176 UnresolvedOdexInstruction INVOKE_VIRTUAL_QUICK_ART Format35ms i=178 UnresolvedOdexInstruction INVOKE_VIRTUAL_QUICK_ART Format35ms i=180 UnresolvedOdexInstruction INVOKE_VIRTUAL_QUICK_ART Format35ms i=184 UnresolvedOdexInstruction IGET_WIDE_QUICK_ART Format22cs i=186 UnresolvedOdexInstruction INVOKE_VIRTUAL_QUICK_ART Format35ms i=187 UnresolvedOdexInstruction INVOKE_VIRTUAL_QUICK_ART Format35ms i=189 UnresolvedOdexInstruction INVOKE_VIRTUAL_QUICK_ART Format35ms i=191 UnresolvedOdexInstruction INVOKE_VIRTUAL_QUICK_ART Format35ms i=195 UnresolvedOdexInstruction IGET_WIDE_QUICK_ART Format22cs i=197 UnresolvedOdexInstruction INVOKE_VIRTUAL_QUICK_ART Format35ms i=198 UnresolvedOdexInstruction INVOKE_VIRTUAL_QUICK_ART Format35ms i=200 UnresolvedOdexInstruction INVOKE_VIRTUAL_QUICK_ART Format35ms i=202 UnresolvedOdexInstruction INVOKE_VIRTUAL_QUICK_ART Format35ms i=206 UnresolvedOdexInstruction IGET_OBJECT_QUICK_ART Format22cs i=208 UnresolvedOdexInstruction INVOKE_VIRTUAL_QUICK_ART Format35ms i=209 UnresolvedOdexInstruction INVOKE_VIRTUAL_QUICK_ART Format35ms i=211 UnresolvedOdexInstruction INVOKE_VIRTUAL_QUICK_ART Format35ms i=213 UnresolvedOdexInstruction INVOKE_VIRTUAL_QUICK_ART Format35ms i=217 UnresolvedOdexInstruction IGET_OBJECT_QUICK_ART Format22cs i=219 UnresolvedOdexInstruction INVOKE_VIRTUAL_QUICK_ART Format35ms i=220 UnresolvedOdexInstruction INVOKE_VIRTUAL_QUICK_ART Format35ms i=222 UnresolvedOdexInstruction INVOKE_VIRTUAL_QUICK_ART Format35ms i=224 UnresolvedOdexInstruction INVOKE_VIRTUAL_QUICK_ART Format35ms i=228 UnresolvedOdexInstruction IGET_OBJECT_QUICK_ART Format22cs i=230 UnresolvedOdexInstruction INVOKE_VIRTUAL_QUICK_ART Format35ms i=231 UnresolvedOdexInstruction INVOKE_VIRTUAL_QUICK_ART Format35ms i=233 UnresolvedOdexInstruction INVOKE_VIRTUAL_QUICK_ART Format35ms i=235 UnresolvedOdexInstruction INVOKE_VIRTUAL_QUICK_ART Format35ms i=239 UnresolvedOdexInstruction IGET_OBJECT_QUICK_ART Format22cs i=241 UnresolvedOdexInstruction INVOKE_VIRTUAL_QUICK_ART Format35ms i=242 UnresolvedOdexInstruction INVOKE_VIRTUAL_QUICK_ART Format35ms i=244 UnresolvedOdexInstruction INVOKE_VIRTUAL_QUICK_ART Format35ms i=246 UnresolvedOdexInstruction INVOKE_VIRTUAL_QUICK_ART Format35ms i=250 UnresolvedOdexInstruction IGET_OBJECT_QUICK_ART Format22cs i=252 UnresolvedOdexInstruction INVOKE_VIRTUAL_QUICK_ART Format35ms i=253 UnresolvedOdexInstruction INVOKE_VIRTUAL_QUICK_ART Format35ms i=255 UnresolvedOdexInstruction INVOKE_VIRTUAL_QUICK_ART Format35ms i=257 UnresolvedOdexInstruction INVOKE_VIRTUAL_QUICK_ART Format35ms i=261 UnresolvedOdexInstruction IGET_OBJECT_QUICK_ART Format22cs i=263 UnresolvedOdexInstruction INVOKE_VIRTUAL_QUICK_ART Format35ms i=264 UnresolvedOdexInstruction INVOKE_VIRTUAL_QUICK_ART Format35ms i=266 UnresolvedOdexInstruction INVOKE_VIRTUAL_QUICK_ART Format35ms i=268 UnresolvedOdexInstruction INVOKE_VIRTUAL_QUICK_ART Format35ms i=272 UnresolvedOdexInstruction IGET_OBJECT_QUICK_ART Format22cs i=274 UnresolvedOdexInstruction INVOKE_VIRTUAL_QUICK_ART Format35ms i=275 UnresolvedOdexInstruction INVOKE_VIRTUAL_QUICK_ART Format35ms i=277 UnresolvedOdexInstruction INVOKE_VIRTUAL_QUICK_ART Format35ms i=279 UnresolvedOdexInstruction INVOKE_VIRTUAL_QUICK_ART Format35ms i=283 UnresolvedOdexInstruction IGET_BOOLEAN_QUICK_ART Format22cs i=285 UnresolvedOdexInstruction INVOKE_VIRTUAL_QUICK_ART Format35ms i=286 UnresolvedOdexInstruction INVOKE_VIRTUAL_QUICK_ART Format35ms i=288 UnresolvedOdexInstruction INVOKE_VIRTUAL_QUICK_ART Format35ms i=290 UnresolvedOdexInstruction INVOKE_VIRTUAL_QUICK_ART Format35ms i=294 UnresolvedOdexInstruction IGET_BOOLEAN_QUICK_ART Format22cs i=296 UnresolvedOdexInstruction INVOKE_VIRTUAL_QUICK_ART Format35ms i=297 UnresolvedOdexInstruction INVOKE_VIRTUAL_QUICK_ART Format35ms i=299 UnresolvedOdexInstruction INVOKE_VIRTUAL_QUICK_ART Format35ms i=301 UnresolvedOdexInstruction INVOKE_VIRTUAL_QUICK_ART Format35ms i=305 UnresolvedOdexInstruction IGET_BOOLEAN_QUICK_ART Format22cs i=307 UnresolvedOdexInstruction INVOKE_VIRTUAL_QUICK_ART Format35ms i=308 UnresolvedOdexInstruction INVOKE_VIRTUAL_QUICK_ART Format35ms i=310 UnresolvedOdexInstruction INVOKE_VIRTUAL_QUICK_ART Format35ms i=312 UnresolvedOdexInstruction INVOKE_VIRTUAL_QUICK_ART Format35ms i=316 UnresolvedOdexInstruction IGET_OBJECT_QUICK_ART Format22cs i=318 UnresolvedOdexInstruction INVOKE_VIRTUAL_QUICK_ART Format35ms i=319 UnresolvedOdexInstruction INVOKE_VIRTUAL_QUICK_ART Format35ms i=321 UnresolvedOdexInstruction INVOKE_VIRTUAL_QUICK_ART Format35ms i=323 UnresolvedOdexInstruction INVOKE_VIRTUAL_QUICK_ART Format35ms i=327 UnresolvedOdexInstruction IGET_OBJECT_QUICK_ART Format22cs i=329 UnresolvedOdexInstruction INVOKE_VIRTUAL_QUICK_ART Format35ms i=330 UnresolvedOdexInstruction INVOKE_VIRTUAL_QUICK_ART Format35ms i=332 UnresolvedOdexInstruction INVOKE_VIRTUAL_QUICK_ART Format35ms i=334 UnresolvedOdexInstruction INVOKE_VIRTUAL_QUICK_ART Format35ms i=338 UnresolvedOdexInstruction IGET_OBJECT_QUICK_ART Format22cs i=340 UnresolvedOdexInstruction INVOKE_VIRTUAL_QUICK_ART Format35ms i=341 UnresolvedOdexInstruction INVOKE_VIRTUAL_QUICK_ART Format35ms i=343 UnresolvedOdexInstruction INVOKE_VIRTUAL_QUICK_ART Format35ms i=345 UnresolvedOdexInstruction INVOKE_VIRTUAL_QUICK_ART Format35ms i=346

10-05 20:37:21:492 Analysis error in class=Lcom/android/internal/telephony/cdma/CdmaServiceStateTracker; method=dump opcode: iget-boolean-quick code address: 199 method: Lcom/android/internal/telephony/cdma/CdmaServiceStateTracker;->dump(Ljava/io/FileDescriptor;Ljava/io/PrintWriter;[Ljava/lang/String;)V

10-05 20:37:21:493 org.jf.dexlib2.analysis.AnalysisException: Could not resolve the field in class Lcom/android/internal/telephony/cdma/CdmaServiceStateTracker; at offset 253 in dump at org.jf.dexlib2.analysis.MethodAnalyzer.analyzeIputIgetQuick(MethodAnalyzer.java:1638) at org.jf.dexlib2.analysis.MethodAnalyzer.analyzeInstruction(MethodAnalyzer.java:982) at org.jf.dexlib2.analysis.MethodAnalyzer.analyze(MethodAnalyzer.java:211) at org.jf.dexlib2.analysis.MethodAnalyzer.(MethodAnalyzer.java:149) at org.rh.smaliex.OatUtil$OatDexRewriterModule$1$1.getInstructions(OatUtil.java:591) at org.jf.dexlib2.immutable.ImmutableMethodImplementation.of(ImmutableMethodImplementation.java:82) at org.jf.dexlib2.immutable.ImmutableMethod.(ImmutableMethod.java:72) at org.jf.dexlib2.immutable.ImmutableMethod.of(ImmutableMethod.java:95) at org.jf.dexlib2.immutable.ImmutableMethod$1.makeImmutable(ImmutableMethod.java:129) at org.jf.dexlib2.immutable.ImmutableMethod$1.makeImmutable(ImmutableMethod.java:120) at org.jf.util.ImmutableConverter$3.next(ImmutableConverter.java:139) at com.google.common.collect.ImmutableCollection$Builder.addAll(ImmutableCollection.java:301) at com.google.common.collect.ImmutableSet$Builder.addAll(ImmutableSet.java:522) at com.google.common.collect.ImmutableSortedSet$Builder.addAll(ImmutableSortedSet.java:551) at com.google.common.collect.ImmutableSortedSet.copyOf(ImmutableSortedSet.java:326) at org.jf.util.ImmutableConverter.toSortedSet(ImmutableConverter.java:137) at org.jf.dexlib2.immutable.ImmutableMethod.immutableSetOf(ImmutableMethod.java:116) at org.jf.dexlib2.immutable.ImmutableClassDef.(ImmutableClassDef.java:109) at org.jf.dexlib2.immutable.ImmutableClassDef.of(ImmutableClassDef.java:138) at org.jf.dexlib2.immutable.ImmutableClassDef$3.makeImmutable(ImmutableClassDef.java:209) at org.jf.dexlib2.immutable.ImmutableClassDef$3.makeImmutable(ImmutableClassDef.java:200) at org.jf.util.ImmutableConverter$2.next(ImmutableConverter.java:105) at com.google.common.collect.ImmutableCollection$Builder.addAll(ImmutableCollection.java:301) at com.google.common.collect.ImmutableSet$Builder.addAll(ImmutableSet.java:522) at com.google.common.collect.ImmutableSet.copyOf(ImmutableSet.java:321) at org.jf.util.ImmutableConverter.toSet(ImmutableConverter.java:103) at org.jf.dexlib2.immutable.ImmutableClassDef.immutableSetOf(ImmutableClassDef.java:196) at org.jf.dexlib2.immutable.ImmutableDexFile.(ImmutableDexFile.java:47) at org.jf.dexlib2.immutable.ImmutableDexFile.of(ImmutableDexFile.java:58) at org.rh.smaliex.OatUtil$OatDexRewriter.rewriteDexFile(OatUtil.java:545) at org.rh.smaliex.OatUtil.convertToDex(OatUtil.java:306) at org.rh.smaliex.OatUtil.extractDexFromBootOat(OatUtil.java:233) at org.rh.smaliex.OatUtil.bootOat2Dex(OatUtil.java:146) at org.rh.smaliex.Main.main(Main.java:61) opcode: iget-boolean-quick code address: 199 method: Lcom/android/internal/telephony/cdma/CdmaServiceStateTracker;->dump(Ljava/io/FileDescriptor;Ljava/io/PrintWriter;[Ljava/lang/String;)V

10-05 20:37:21:493 Failed to re-construct dex java.lang.ClassCastException: org.jf.dexlib2.analysis.UnresolvedOdexInstruction cannot be cast to org.jf.dexlib2.iface.instruction.formats.Instruction22cs 10-05 20:37:21:493 convertToDex: skip /system/framework/telephony-common.jar

mmhobi7 commented 9 years ago

The first one I reported

testwhat commented 9 years ago

Could you provide the oat file?

pipop62 commented 9 years ago

Surething!, Thanks for looking into it. http://www.megafileupload.com/9uuP/boot.oat

andreya108 commented 9 years ago

This issue was present also in baksmali 2.1.0 but already fixed in master branch. Since now it also has mm deodex ability I can report that successfully deodexed mra58k framework with current baksmali.

testwhat commented 9 years ago

Please have a try on latest version. https://github.com/testwhat/SmaliEx/blob/master/smaliex-bin/oat2dex.jar

pipop62 commented 9 years ago

Sorry for the delay was out of town, this version seems deodexing the files correctly without errors, but need still a couple of days to check if the files are booting correctly aswell, thanks

pipop62 commented 9 years ago

i've checked the output of those two files, sorry for the delay. I've compared the oat2dex output with the aosp one to see if there were any major differences. telephony-common.jar from boot.oat doesn't decompile using latest baksmali, while the aosp one does, so there may be an issue. The error is on the same class it was creating the issue on previous release of oat2dex. Here's the output of baksmali:

Error occurred while disassembling class Lcom.android.internal.telephony.cdma.CdmaServiceStateTracker; - skipping class org.jf.util.ExceptionWithContext: The last instruction in the method is truncated at org.jf.dexlib2.dexbacked.DexBackedMethodImplementation$1$1.readNextItem(DexBackedMethodImplementation.java:87) at org.jf.dexlib2.dexbacked.DexBackedMethodImplementation$1$1.readNextItem(DexBackedMethodImplementation.java:75) at org.jf.dexlib2.dexbacked.util.VariableSizeLookaheadIterator.computeNext(VariableSizeLookaheadIterator.java:60) at com.google.common.collect.AbstractIterator.tryToComputeNext(AbstractIterator.java:143) at com.google.common.collect.AbstractIterator.hasNext(AbstractIterator.java:138) at com.google.common.collect.ImmutableCollection$Builder.addAll(ImmutableCollection.java:300) at com.google.common.collect.ImmutableList$Builder.addAll(ImmutableList.java:691) at com.google.common.collect.ImmutableList.copyOf(ImmutableList.java:275) at com.google.common.collect.ImmutableList.copyOf(ImmutableList.java:226) at org.jf.baksmali.Adaptors.MethodDefinition.(MethodDefinition.java:92) at org.jf.baksmali.Adaptors.ClassDefinition.writeVirtualMethods(ClassDefinition.java:326) at org.jf.baksmali.Adaptors.ClassDefinition.writeTo(ClassDefinition.java:113) at org.jf.baksmali.baksmali.disassembleClass(baksmali.java:225) at org.jf.baksmali.baksmali.access$000(baksmali.java:55) at org.jf.baksmali.baksmali$1.call(baksmali.java:149) at org.jf.baksmali.baksmali$1.call(baksmali.java:147) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Error while processing method Lcom/android/internal/telephony/cdma/CdmaServiceStateTracker;->dump(Ljava/io/FileDescriptor;Ljava/io/PrintWriter;[Ljava/lang/String;)V

Error occurred while disassembling class Lcom.android.internal.telephony.gsm.GsmServiceStateTracker; - skipping class org.jf.util.ExceptionWithContext: The last instruction in the method is truncated at org.jf.dexlib2.dexbacked.DexBackedMethodImplementation$1$1.readNextItem(DexBackedMethodImplementation.java:87) at org.jf.dexlib2.dexbacked.DexBackedMethodImplementation$1$1.readNextItem(DexBackedMethodImplementation.java:75) at org.jf.dexlib2.dexbacked.util.VariableSizeLookaheadIterator.computeNext(VariableSizeLookaheadIterator.java:60) at com.google.common.collect.AbstractIterator.tryToComputeNext(AbstractIterator.java:143) at com.google.common.collect.AbstractIterator.hasNext(AbstractIterator.java:138) at com.google.common.collect.ImmutableCollection$Builder.addAll(ImmutableCollection.java:300) at com.google.common.collect.ImmutableList$Builder.addAll(ImmutableList.java:691) at com.google.common.collect.ImmutableList.copyOf(ImmutableList.java:275) at com.google.common.collect.ImmutableList.copyOf(ImmutableList.java:226) at org.jf.baksmali.Adaptors.MethodDefinition.(MethodDefinition.java:92) at org.jf.baksmali.Adaptors.ClassDefinition.writeVirtualMethods(ClassDefinition.java:326) at org.jf.baksmali.Adaptors.ClassDefinition.writeTo(ClassDefinition.java:113) at org.jf.baksmali.baksmali.disassembleClass(baksmali.java:225) at org.jf.baksmali.baksmali.access$000(baksmali.java:55) at org.jf.baksmali.baksmali$1.call(baksmali.java:149) at org.jf.baksmali.baksmali$1.call(baksmali.java:147) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Error while processing method Lcom/android/internal/telephony/gsm/GsmServiceStateTracker;->dump(Ljava/io/FileDescriptor;Ljava/io/PrintWriter;[Ljava/lang/String;)V

core-libart instead decompile succesfully and comparing with aosp one i noticed just this different. Not sure if relevant here.

every check-cast in the aosp one is just a nop in the one from oat2dex

aosp : check-cast v12, [Ljava/lang/Class; stock: nop nop

Hope this may help. Sorry again for the delay but was out for a business trip.

testwhat commented 9 years ago

It is normal check-cast will be optimized to 2 nop: http://androidxref.com/6.0.0_r1/xref/art/compiler/dex/dex_to_dex_compiler.cc#200

I have not implemented recover check-cast because there is still other information could help to resolve correct field/method, so keep the instruction as nop-nop should be no hurt.