secure-software-engineering / FlowDroid

FlowDroid Static Data Flow Tracker
GNU Lesser General Public License v2.1
1.07k stars 301 forks source link

Call Graph generation has so many warnings on "Could not find a suitable constructor for" and "Could not find layout class" #135

Open terry2012 opened 5 years ago

terry2012 commented 5 years ago

Dear @StevenArzt and @mbenz89

I found that no matter which apks I analyzed to generate a call graph, FlowDroid reports so many warnings on "Could not find a suitable constructor for" and "Could not find layout class". Does it mean that the generated call graph is not completed? Why such warnings could happen? Thanks.

Some partial running logs of an apk is as follows:

......
[main] WARN soot.jimple.infoflow.android.entryPointCreators.components.ServiceEntryPointCreator - Could not find a suitable constructor for class com.sina.weibo.appmarket.sng.activity.SngHtml5GameContainerActivity
[main] WARN soot.jimple.infoflow.android.entryPointCreators.components.ServiceEntryPointCreator - Constructor cannot be generated for com.sina.weibo.appmarket.sng.activity.SngHtml5GameContainerActivity
[main] WARN soot.jimple.infoflow.android.entryPointCreators.components.ServiceEntryPointCreator - Could not find a suitable constructor for class com.facebook.LoginActivity
[main] WARN soot.jimple.infoflow.android.entryPointCreators.components.ServiceEntryPointCreator - Constructor cannot be generated for com.facebook.LoginActivity
[main] WARN soot.jimple.infoflow.android.entryPointCreators.components.ServiceEntryPointCreator - Could not find a suitable constructor for class com.sina.weibo.ChoiceActivity
[main] WARN soot.jimple.infoflow.android.entryPointCreators.components.ServiceEntryPointCreator - Constructor cannot be generated for com.sina.weibo.ChoiceActivity
[main] WARN soot.jimple.infoflow.android.entryPointCreators.components.ServiceEntryPointCreator - Could not find a suitable constructor for class com.sina.weibo.RemindRelationActivity
[main] WARN soot.jimple.infoflow.android.entryPointCreators.components.ServiceEntryPointCreator - Constructor cannot be generated for com.sina.weibo.RemindRelationActivity
[main] WARN soot.jimple.infoflow.android.entryPointCreators.components.ServiceEntryPointCreator - Could not find a suitable constructor for class com.sina.weibo.photoalbum.video.VideoCutActivity
[main] WARN soot.jimple.infoflow.android.entryPointCreators.components.ServiceEntryPointCreator - Constructor cannot be generated for com.sina.weibo.photoalbum.video.VideoCutActivity
[main] INFO soot.jimple.infoflow.android.SetupApplication - Constructing the callgraph...
[main] INFO soot.jimple.infoflow.android.callbacks.DefaultCallbackAnalyzer - Collecting callbacks in DEFAULT mode...
[main] INFO soot.jimple.infoflow.android.callbacks.DefaultCallbackAnalyzer - Callback analysis done.
[main] WARN soot.jimple.infoflow.android.resources.LayoutFileParser - Could not find layout class com.sina.weibo.photoalbum.view.Pic9CutFinder
[main] WARN soot.jimple.infoflow.android.resources.LayoutFileParser - Could not find layout class com.sina.weibo.photoalbum.view.PicCropViewFinder
[main] WARN soot.jimple.infoflow.android.resources.LayoutFileParser - Could not find layout class com.sina.weibo.photoalbum.crop.CropImageView
[main] WARN soot.jimple.infoflow.android.resources.LayoutFileParser - Could not find layout class com.sina.weibo.photoalbum.video.edit.ThemeGroupLayout
[main] WARN soot.jimple.infoflow.android.resources.LayoutFileParser - Could not find layout class com.sina.weibo.photoalbum.video.edit.ThemeGroupLayout
[main] WARN soot.jimple.infoflow.android.resources.LayoutFileParser - Could not find layout class com.sina.weibo.photoalbum.video.VideoViewTouch
[main] WARN soot.jimple.infoflow.android.resources.LayoutFileParser - Could not find layout class com.sina.weibo.multimedia.video.VideoCutView
[main] WARN soot.jimple.infoflow.android.resources.LayoutFileParser - Could not find layout class android.support.v4.view.ViewPager
.....
[main] WARN soot.jimple.infoflow.android.entryPointCreators.components.ActivityEntryPointCreator - Cannot create valid constructor for com.sina.weibo.BasePayOrderActivity, because it is abstract and cannot substitute with subclass
[main] WARN soot.jimple.infoflow.android.entryPointCreators.components.ActivityEntryPointCreator - Cannot create valid constructor for com.sina.weibo.view.bb$d, because it is an interface and cannot substitute with subclass
[main] WARN soot.jimple.infoflow.android.entryPointCreators.components.ActivityEntryPointCreator - Cannot create valid constructor for com.sina.weibo.BasePayOrderActivity, because it is abstract and cannot substitute with subclass
[main] WARN soot.jimple.infoflow.android.entryPointCreators.components.ActivityEntryPointCreator - Cannot create valid constructor for com.sina.weibo.BasePayOrderActivity, because it is abstract and cannot substitute with subclass
[main] WARN soot.jimple.infoflow.android.entryPointCreators.components.ActivityEntryPointCreator - Cannot create valid constructor for com.sina.weibo.BasePayOrderActivity, because it is abstract and cannot substitute with subclass
[main] WARN soot.jimple.infoflow.android.entryPointCreators.components.ActivityEntryPointCreator - Cannot create valid constructor for com.sina.weibo.BasePayOrderActivity, because it is abstract and cannot substitute with subclass
[main] WARN soot.jimple.infoflow.android.entryPointCreators.components.BroadcastReceiverEntryPointCreator - Cannot create valid constructor for com.sina.weibo.BasePayOrderActivity, because it is abstract and cannot substitute with subclass
[main] WARN soot.jimple.infoflow.android.entryPointCreators.components.ActivityEntryPointCreator - Cannot create valid constructor for com.sina.weibo.BasePayOrderActivity, because it is abstract and cannot substitute with subclass
......

Just too too many such warnings. I am wondering why (any misconfiguration at my side?) and how to resolve them? Thanks.

StevenArzt commented 5 years ago

I'll remove the warnings from the code. They are useful for developers who work on the FlowDroid code or who want to diagnose a problem, but for the common user, they're plain useless. You can safely ignore them.

terry2012 commented 5 years ago

Thanks for the reply. So are the entry points in my case created correctly?

I remembered that call graph generation in previous versions of FlowDroid is slow. Why is it fast now in recent versions? Any hints? Thanks. Is some analysis offloaded to the actual taint analysis phase? For example, those implicit flows.

neupaneprakash commented 2 years ago

Hello @StevenArzt and @mbenz89 Whichever apks I analyzed to generate a call graph, FlowDroid repeatedly keeps on printing "Constructing callgraph... " Some partial running logs of an apk is as follows:

[main] INFO soot.jimple.infoflow.android.callbacks.DefaultCallbackAnalyzer - Running incremental callback analysis for 14 components... [main] INFO soot.jimple.infoflow.android.callbacks.DefaultCallbackAnalyzer - Incremental callback analysis done. [main] INFO soot.jimple.infoflow.android.entryPointCreators.AndroidEntryPointCreator - Creating Android entry point for 142 components... [main] WARN soot.jimple.infoflow.android.entryPointCreators.components.ActivityEntryPointCreator - Cannot create valid constructor for kotlin.coroutines.CoroutineContext, because it is an interface and cannot substitute with subclass [main] WARN soot.jimple.infoflow.android.entryPointCreators.components.ActivityEntryPointCreator - Cannot create valid constructor for androidx.compose.ui.platform.AbstractComposeView, because it is abstract and cannot substitute with subclass [main] INFO soot.jimple.infoflow.android.SetupApplication - Constructing the callgraph... [main] INFO soot.jimple.infoflow.android.callbacks.DefaultCallbackAnalyzer - Running incremental callback analysis for 1 components... [main] INFO soot.jimple.infoflow.android.callbacks.DefaultCallbackAnalyzer - Incremental callback analysis done. [main] INFO soot.jimple.infoflow.android.entryPointCreators.AndroidEntryPointCreator - Creating Android entry point for 142 components... [main] WARN soot.jimple.infoflow.android.entryPointCreators.components.ActivityEntryPointCreator - Cannot create valid constructor for kotlin.coroutines.CoroutineContext, because it is an interface and cannot substitute with subclass [main] WARN soot.jimple.infoflow.android.entryPointCreators.components.ActivityEntryPointCreator - Cannot create valid constructor for androidx.compose.ui.platform.AbstractComposeView, because it is abstract and cannot substitute with subclass [main] INFO soot.jimple.infoflow.android.SetupApplication - Constructing the callgraph...

Does it mean that the generated call graph is not completed? How long should one run the analysis to get final call graph constructed? (Because it wont terminate for 45 minutes for some small apks like Slack, Twitter, Instagram etc.)

I am using: java version "18.0.1.1" 2022-04-22 Java(TM) SE Runtime Environment (build 18.0.1.1+2-6) Java HotSpot(TM) 64-Bit Server VM (build 18.0.1.1+2-6, mixed mode, sharing)

Could you please suggest ways to resolve this issue? Thanks.