FlowDroid
FlowDroid copied to clipboard
It takes a long time to run some APK Sample in soot dexpler DexBody
Hi: I use Flowdroid project for Android static taint analysis, some android apk take a long time for "PackManager.v().runPacks();"
The log is follows,now we have requirements for SLA and response speed. i want to know How to optimize the speed for this stage.
(1)
0:42:33.692 [Thread-1] DEBUG soot.dexpler.DexBody - First instruction of trap handler unit not MoveException but soot.dexpler.instructions.IgetInstruction 00:42:33.704 [Thread-2] DEBUG soot.dexpler.DexBody - First instruction of trap handler unit not MoveException but soot.dexpler.instructions.ReturnInstruction 00:42:33.704 [Thread-5] DEBUG soot.dexpler.DexBody - First instruction of trap handler unit not MoveException but soot.dexpler.instructions.ConstInstruction 00:42:33.715 [Thread-11] DEBUG soot.dexpler.DexBody - First instruction of trap handler unit not MoveException but soot.dexpler.instructions.ReturnVoidInstruction 00:42:33.715 [Thread-2] DEBUG soot.dexpler.DexBody - First instruction of trap handler unit not MoveException but soot.dexpler.instructions.ConstStringInstruction 00:42:33.715 [Thread-6] DEBUG soot.dexpler.DexBody - First instruction of trap handler unit not MoveException but soot.dexpler.instructions.ConstStringInstruction 00:42:33.720 [Thread-6] DEBUG soot.dexpler.DexBody - First instruction of trap handler unit not MoveException but soot.dexpler.instructions.ConstStringInstruction 00:42:33.753 [Thread-9] DEBUG soot.dexpler.DexBody - First instruction of trap handler unit not MoveException but soot.dexpler.instructions.CastInstruction 00:42:33.753 [Thread-7] DEBUG soot.dexpler.DexBody - First instruction of trap handler unit not MoveException but soot.dexpler.instructions.IgetInstruction 00:42:33.754 [Thread-10] DEBUG soot.dexpler.DexBody - First instruction of trap handler unit not MoveException but soot.dexpler.instructions.ReturnInstruction 00:42:33.847 [Thread-6] DEBUG soot.dexpler.DexBody - First instruction of trap handler unit not MoveException but soot.dexpler.instructions.ReturnInstruction
01:03:50.721 [main] DEBUG soot.toolkits.scalar.ConstantInitializerToTagTransformer - WARNING: Constant value for field '<com.xxx.xxx.biz.report.StatisHelper: int CASE_ID_PREF_LEN>' mismatch between code (6) and constant table (ConstantValue: 0) (it take 21 minutes !!!!!)
01:03:52.046 [main] DEBUG soot.toolkits.scalar.ConstantInitializerToTagTransformer - WARNING: Constant value for field '<kotlin.jvm.internal.FloatCompanionObject: float NaN>' mismatch between code (#NaNF) and constant table (ConstantValue: NaN) 01:03:52.370 [main] DEBUG soot.toolkits.scalar.ConstantInitializerToTagTransformer - WARNING: Constant value for field '<kotlin.jvm.internal.DoubleCompanionObject: double NaN>' mismatch between code (#NaN) and constant table (ConstantValue: NaN)
(2)
00:09:32.239 [Thread-11] DEBUG soot.dexpler.DexBody - First instruction of trap handler unit not MoveException but soot.dexpler.instructions.ReturnInstruction 00:09:32.239 [Thread-11] DEBUG soot.dexpler.DexBody - First instruction of trap handler unit not MoveException but soot.dexpler.instructions.ReturnInstruction 00:09:32.240 [Thread-11] DEBUG soot.dexpler.DexBody - First instruction of trap handler unit not MoveException but soot.dexpler.instructions.ReturnInstruction 00:09:32.240 [Thread-11] DEBUG soot.dexpler.DexBody - First instruction of trap handler unit not MoveException but soot.dexpler.instructions.ReturnInstruction 00:09:32.240 [Thread-11] DEBUG soot.dexpler.DexBody - First instruction of trap handler unit not MoveException but soot.dexpler.instructions.ReturnInstruction
(it takes 29 minutes!!!!)
00:38:20.789 [main] DEBUG soot.toolkits.scalar.ConstantInitializerToTagTransformer - WARNING: Constant value for field '<com.litesuits.common.io.FilenameUtils: char OTHER_SEPARATOR>' mismatch between code (47) and constant table (ConstantValue: 0) 00:38:20.792 [main] DEBUG soot.toolkits.scalar.ConstantInitializerToTagTransformer - WARNING: Constant value for field '<com.litesuits.common.io.FilenameUtils: char OTHER_SEPARATOR>' mismatch between code (92) and constant table (ConstantValue: 0)
The runPacks code is follows:
final String androidJar = config.getAnalysisFileConfig().getAndroidPlatformDir();
final String apkFileLocation = config.getAnalysisFileConfig().getTargetAPKFile();
G.reset();
Options.v().set_output_format(Options.output_format_jimple);
if(taskType == TYPE_APK_TASK){
Options.v().set_src_prec(Options.src_prec_apk);
Options.v().set_process_dir(Collections.singletonList(apkFileLocation));
}
Options.v().set_force_android_jar(androidJar);
Options.v().set_process_multiple_dex(config.getMergeDexFiles());
Options.v().set_allow_phantom_refs(true);
Options.v().set_exclude(config.getAnalysisFileConfig().getWhiteClassList());
Scene.v().loadNecessaryClasses();
PackManager.v().runPacks();
That doesn't seem to be a FlowDroid issue, but rather a problem with Soot. Does it happen on a specific APK only or on all APKs? How much memory (heap space) did you give your JVM? Have you tried running a profiler to see where the time is spent?