Commit Graph

48 Commits

Author SHA1 Message Date
Julian Dolby a1bc84356d scandriod merge 2014-10-01 21:32:36 -04:00
Juergen Graf fad9e87654 cleanup - organize imports and remove unused code 2014-05-20 19:56:59 +02:00
Juergen Graf 428a3975ed Merge branch 'wala' into master
Conflicts:
	com.ibm.wala.cast.java/src/com/ibm/wala/cast/java/loader/JavaSourceLoaderImpl.java
	com.ibm.wala.cast.java/src/com/ibm/wala/cast/java/ssa/AstJavaInstructionFactory.java
	com.ibm.wala.cast.java/src/com/ibm/wala/cast/java/ssa/AstJavaInvokeInstruction.java
	com.ibm.wala.cast.js.test/harness-src/com/ibm/wala/cast/js/test/TestSimpleCallGraphShape.java
	com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/html/WebPageLoaderFactory.java
	com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/loader/JavaScriptLoader.java
	com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/ssa/JSInstructionFactory.java
	com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/ssa/JavaScriptInvoke.java
	com.ibm.wala.cast/source/java/com/ibm/wala/cast/ipa/callgraph/AstCallGraph.java
	com.ibm.wala.cast/source/java/com/ibm/wala/cast/ir/ssa/AbstractLexicalInvoke.java
	com.ibm.wala.cast/source/java/com/ibm/wala/cast/ir/ssa/AstInstructionFactory.java
	com.ibm.wala.cast/source/java/com/ibm/wala/cast/ir/ssa/AstLexicalRead.java
	com.ibm.wala.cast/source/java/com/ibm/wala/cast/ir/ssa/AstLexicalWrite.java
	com.ibm.wala.cast/source/java/com/ibm/wala/cast/ir/ssa/FixedParametersInvokeInstruction.java
	com.ibm.wala.cast/source/java/com/ibm/wala/cast/ir/translator/AstTranslator.java
	com.ibm.wala.core/.classpath
	com.ibm.wala.core/.settings/org.eclipse.jdt.core.prefs
	com.ibm.wala.ide/src/com/ibm/wala/ide/util/ProgressMonitorDelegate.java
	com.ibm.wala.util/src/com/ibm/wala/util/NullProgressMonitor.java
	com.ibm.wala.util/src/com/ibm/wala/util/ProgressMaster.java
2014-05-20 17:59:16 +02:00
Juergen Graf cf9d623b40 change to compile in eclipse - move files from util to core due to dependencies 2014-05-19 13:24:47 +02:00
Tobias Blaschke 71060b7348 Document Android-Stuff (II) 2014-04-11 17:59:10 +02:00
Tobias Blaschke 92ee930865 Document Android stuff (I)
I'm going through all "my" classes and add documentation where missing.
2014-04-11 17:59:09 +02:00
Tobias Blaschke 5f51dac201 Additional structural Models for Android
Now there are four structural models:
* SequentialAndroidModel:   No loops
* SingleStartAndroidModel:  User Interaction on a single component
* LoopAndroidModel:         Stuff goes into background and comes back
* LoopKillAndroidModel:     Restart of components due to low memory
2014-04-11 17:59:09 +02:00
Tobias Blaschke 1857121a44 Add "Custom Change" where applicable
Added the lines
BEGIN Custom Change
END Custom Change
2014-04-11 17:58:33 +02:00
Tobias Blaschke e1fd417627 Extend DefaultInstantiationBehavior 2014-04-11 17:56:47 +02:00
Tobias Blaschke 851594cff5 Make Intents immutable when attached to Context
Oops.
Fixes in intent-Resolution
2014-04-11 17:56:47 +02:00
Tobias Blaschke 34b5c7284a Allow changing the target of an Intent.
Code oftain sets the action of an Intent after it's constructor. Until
now a call to such a setter caused the Intent to become "unbound"
(conservative).

This approch allows setting the target once for each Intent - only on
the second call the Intent gets unbound.
This new variant could be dangerous: Setting the target in a branch of
execution may be invalid. This should be detected - no guarantees so!

Methods in question are:
* Intent.setAction
* Intent.setComponent
* Intent.setClass
* Intent.setClassName
2014-04-11 17:56:47 +02:00
Tobias Blaschke b27bd944dc IntentModel also calls Application and Provider EPs.
As the IntentModel should only be used on the start of an Analysis this
is the correct approach here.
2014-04-11 17:56:47 +02:00
Tobias Blaschke cbfca1df4e Call setIntent when starting a Component.
Before the Intent would only have been set by calling .attach (if
doBootSequence is enabled). Attach is only called when the modell is
filled with instructions.

This new variant calls setIntent when creating the wrapper for the model
(getMethodAs). This is much better!
2014-04-11 17:56:47 +02:00
Tobias Blaschke eb4e3e4b58 Use setExplicit in androids Intent-Constructor 2014-04-11 17:56:46 +02:00
Tobias Blaschke 5a8c676a76 Disable extraction of AndroidContext
The AndroidContext was not used anyways.
2014-04-11 17:56:46 +02:00
Tobias Blaschke abcd578a61 Use getters and setters for Intents, add explicit-attribute
These Changes are necessary to make the target of an Intent changeable.
Additionaly some preparing changes in the IntentMap
2014-04-11 17:56:46 +02:00
Tobias Blaschke 3533156542 More info on AndroidEntryPoints selected by heuristic 2014-04-11 17:56:46 +02:00
Tobias Blaschke bf0e1a6347 Extend handling of IntentContext
* Create IntentContext even if no info available.
  This is necessary to also track the start of unknown targets.

* Invalidate the target of an Inten upon a call to Intent.setAction
  or Intent.fillIn

Additionally tidied up the classes a bit.
2014-04-11 17:56:46 +02:00
Tobias Blaschke c4eb253721 Fixes in the UnknownTarget model.
Before the model went by the wrong Name, it failed if no app-internal
implementations of the targetType existed.

Also tidied up the code.
2014-04-11 17:56:46 +02:00
Tobias Blaschke bd8f793135 Add a model for SystemServices
The SystemServiceModel creates and returns a new Instance of the
requested Service (if known).

TODO: We should use a single "global" instance per service instead.
2014-04-11 17:56:46 +02:00
Tobias Blaschke 224077d344 Fix Phi-Problem in SpecializedInstantiator
Under some curcumstances there was a hick-up when Phi-ing together some
newly generated instances.
2014-04-11 17:56:46 +02:00
Tobias Blaschke 1121b59b3b Handling getSystemService.
Code to resolve a call to getSystemService to an actual Object based on
the String given to getSystemService.

Currently there's only TelephonyManager.
2014-04-11 17:53:14 +02:00
Tobias Blaschke f561f1213d Make flat components optional 2014-04-11 17:53:14 +02:00
Tobias Blaschke d7f0d07122 Create Conponent instances in clinit 2014-04-11 17:53:14 +02:00
Tobias Blaschke a9864a5dab Added specialized instantiators.
Creating an instance of e.g. Context would pull in all compontents
yielding a ununsable result.
2014-04-11 17:53:13 +02:00
Tobias Blaschke ece84ddf76 Fix field-handling for Intent-Wrappers
The IntentContextInterpreter always returned an empty set of fields
2014-04-11 17:53:13 +02:00
Tobias Blaschke 64749b91fe Decrease some log-levels
Output was a bit to verbose.
2014-04-11 17:53:13 +02:00
Tobias Blaschke b963cc72bb Flatten Android-Component instances
Throw instances of android components into AndroidModelClass and reuse
them. This resembles Android a bit more.
2014-04-11 17:53:13 +02:00
Tobias Blaschke 594447c18f Add AndroidModel.getMethodEncap
Using getMethodEncap a new set of REUSE-Parameters will be generated
using the new Instantiator. Then the model will be called.
2014-04-11 17:53:13 +02:00
Tobias Blaschke add83148a5 Add default Overrides for Intents
Added DEFAULT_INTENT_OVERRIDES to AndroidEntryPointManager. These have
to be added manually.

Added posibility to deliberatly ignore intents
2014-04-11 17:53:13 +02:00
Tobias Blaschke 7aed4b5095 Add IntentModel for starting the analysis at an Intent 2014-04-11 17:53:13 +02:00
Tobias Blaschke 00d711dd64 InducedCFG/GoTo: Handle basic block boundarys
Building the CFG with a SSAGotoInstuction was buggy: Oftain the wrong
jump-target was selected. This has bin fixed.

Additionally InducedCFG now automaticly breaks the basic-block at the
jump-target.

Jumping to Phi-Instructions however is still unsupported (as they are
not part of the cfg-instructions)
2014-04-11 17:53:13 +02:00
Tobias Blaschke 14a9382ac6 Enable components in v4 2014-04-11 17:53:12 +02:00
Tobias Blaschke c8b60ef9dd BUG: Invalid def/Use of IntentSender.<init>
The Analysis has problems with the IntentSender class: Invalid DefUse an
an Init-Call.
The Intent-Starters, that use IntentSender have been made optional.
However disabling them does not help.

Currently the only solution to this problem is adding IntentSender to
the exclusions.txt
2014-04-11 17:53:12 +02:00
Tobias Blaschke 51d25116d9 BUG: Endless Recursion based on RESUE-Settings
Setting the Instantiation-Behavior of Package:
Landroid/support/v4/view
To REUSE causes the following Endless-Recursion in JoDroid:

interproc: computing local killing defintions...       done
Building utility edges  Exception in thread "main" java.lang.StackOverflowError
        at java.util.HashMap.put(HashMap.java:389)
        at org.jgrapht.graph.AbstractBaseGraph.addEdge(Unknown Source)
        at edu.kit.joana.util.graph.AbstractJoanaGraph.addEdge(AbstractJoanaGraph.java:50)
        at edu.kit.joana.wala.core.DependenceGraph.addEdge(DependenceGraph.java:76)
        at edu.kit.joana.wala.core.joana.JoanaConverter$UtilityEdgeWalker.discover(JoanaConverter.java:344)
        at edu.kit.joana.wala.core.joana.JoanaConverter$UtilityEdgeWalker.discover(JoanaConverter.java:325)
        at edu.kit.joana.wala.core.graphs.GraphWalker.dfs(GraphWalker.java:55)
        at edu.kit.joana.wala.core.graphs.GraphWalker.dfs(GraphWalker.java:63)
        at edu.kit.joana.wala.core.graphs.GraphWalker.dfs(GraphWalker.java:63)
        at edu.kit.joana.wala.core.graphs.GraphWalker.dfs(GraphWalker.java:63)
        ...

As this package contains System-provided android-components it should however be marked REUSE in order to be able to read back values when these types are used.
2014-04-11 17:53:12 +02:00
Tobias Blaschke 329e55990e Lower log-level on stub-induced warnings
The Log-Level for types and unimplemented interfaces from the stubs used
to be WARN and ERROR. This was reduced to DEBUG.
2014-04-11 17:53:12 +02:00
Tobias Blaschke 326404ff53 Fix: Instantiator - Array of Interface caused endless recursion
When creating an instance of an array whose payload-type is an interface
the Instantiator would get stuck in an endless recursion.
2014-04-11 17:53:12 +02:00
Tobias Blaschke f261d2e9ab Dalvik: Mark files for deletion
Classes not needed any longer have been marked as @deprecated
2014-04-11 17:53:12 +02:00
Tobias Blaschke 80c022f525 AndroidContext: Explicitly hand through on Intent-Start (coarse)
PARTIALLY:
Android-Context is explicitly assigned when Intents are started.

Not all types of Context are handled correctly yet.
2014-04-11 17:53:12 +02:00
Tobias Blaschke 9c7a2eb975 Build coarse Android Environment
Governed by AndroidEntryPointManager.setDoBootSequence generate some
coarse Android-environment before starting the LiveCycle-Model.

Some action is taken to attach the Android-Context to Components - much
is still missing there though.
Thin context is mainly useful when starting Intents of an external App.
2014-04-11 17:53:11 +02:00
Tobias Blaschke 5ba668c8ae Android Intents: add special context
Whenever an Intent is encountered while building the CallGraph a
WALA-Context is generated for it. If a new Android-Component is started
and the Context is sufficient the start-function will call a new type of
model, the MicroModel.

The MicroModel resemples the livecycle of a single Android-Component.
2014-04-11 17:53:11 +02:00
Tobias Blaschke c33207d793 Android-Intents: context-free overrides
Whenever the start of an intent is encountered the start-function is
replaced by a call to UnknownTargetModel.

UnknownTargetModel will call a restricted android-model (i.e. one that calls only all
Activities). This restricted model is known as MiniModel.
It will also call ExternalModel which does nothing special.
2014-04-11 17:53:11 +02:00
Tobias Blaschke beb97a59e9 Add structure to Android Livecycle
The added structure is governed by an AbstractAndroidModel. When
"labels" are stepped over it may insert special handling code.
2014-04-11 17:53:11 +02:00
Tobias Blaschke 64a1eb0a60 Build basic Android-Livecycle (sequential)
Generate a synthetic AndroidModel in AndroidModelClass.
The model will contain Android EntryPoints in a sorted manner. However
no special handling (loops) are inserted yet.

Intents are not processed at all - thus have to be marked insecure.
2014-04-11 17:53:11 +02:00
Tobias Blaschke a05c823724 Add structures for parameters to Androids entrypoints
Parameters to Androids EntryPoint-Functions may be either marked CREATE
or REUSE. Added these markers and made them availabel through
AndroidEntryPointManager.
2014-04-11 17:53:11 +02:00
Tobias Blaschke 1e9298f3d7 Locate Androids EntryPoints
Locating them will be based on a set of hardcoded specifications (next
commit) or by using heuristics.
2014-04-11 17:53:10 +02:00
Juergen Graf 5a06c07ca7 remove warnings from com.ibm.wala.dalvik 2013-03-12 01:24:38 +01:00
Martin Mohr 3e9751539c new project: WALA frontend for dalvik bytecode (based on SCanDroid) 2013-01-31 16:54:35 +01:00