performance, meaning the minimization of slowdown caused by the
analysis.
In general, the developer of a DPA tool has to deal with two
principal concerns at different levels of abstraction. One concern
is the design and implementation of the analysis itself, which
comprises the analysis algorithms, data structures for maintaining
analysis state, and reaction to base program events that drive the
analysis. The other concern is ensuring that the events of interest
occurring in the base program will be reported to the analysis; this
often requires modification of the base program code or special
hooks in the execution platform.
In our previous work, we tackled various aspects of DPA tool
development. In DiSL [
17
], we provide a domain-specific aspect lan-
guage that enables rapid development of efficient instrumentations.
The code to be inserted into the base program is expressed using
snippets of Java code, with the desired location of the code specified
declaratively in snippet annotations. In FRANC [
1
], we provide
support for modularization of DPA tools, enabling composition of
analysis tools from modules capturing recurring instrumentation
and analysis tasks. Finally, in ShadowVM [
16
] we provide a system
for dynamic analysis of programs running within the JVM, which
achieves strong isolation and high coverage. The
ShadowVM
ap-
proach is based on executing the analysis code in a separate JVM,
asynchronously with respect to the observed program. The observed
program is instrumented using DiSL to emit the events of interests,
which are then forwarded to the analysis executing in the separate
JVM.
We necessarily build on our previous efforts—we rely on DiSL
for instrumentation, and on the
ShadowVM
concept of separate
analysis server for isolating analysis execution from the base pro-
gram. The novelty of this work lies in enabling development of DPA
tools on Android, which goes far beyond mere reuse of existing
components, both in scope and effort. In targeting the Android plat-
form, we enable development of cross-platform analyses using a
common programming model, which allows using a single analysis
for both Android and Java platforms. To achieve that, we address
many specific design and technical issues, such as support for appli-
cations executing in multiple virtual machines, inter-component and
inter-process communication, and many others, which we present in
the following sections.
3. DPA Framework Architecture
The design of the DPA framework seeks to accommodate the major
dynamic analysis requirements—high coverage, strong isolation,
programming simplicity and acceptable performance—in the con-
text of applications that follow the Android component model. The
most visible trait of the design is the separation of analysis from
the executing application, which is not common in conventional
DPA frameworks, where it may appear reasonable to colocate the
analysis with the executing application to achieve low overhead
in accessing the application state. With applications consisting of
multiple components possibly executing in separate DVM instances,
colocating the analysis with the application would result in distribut-
ing the analysis state with the application components. This might
not matter with analyses that can partition their state to mirror the
partitioning of the application, but in general, partitioning analysis
state would needlessly complicate the analysis code.
The component model also brings the existence of multiple entry
points; instead of being launched through a single entry point, as is
common with desktop and server applications, each application
component can be activated by the system independently. The
components execute in response to asynchronous messages (intents)
sent by other components. In fact, an application can also integrate
components from other applications by using implicit intents that do
not specify a specific receiver. The potentially complex control flow
Figure 1: The ShadowVM architecture for Android.
is another factor for separating the analysis from the application.
It also necessitates that the DPA framework tracks the component
communication and informs the analysis about the implied control
flow.
Finally, Android applications execute in what is (at least from
the perspective of contemporary desktop and server platforms) a
resource-constrained environment. While it is possible to execute
the analysis server in the Android environment, doing so would
typically make it compete for resources with the analyzed applica-
tion. We therefore execute the analysis on a remote system, which
is fed with the observed events. The remote execution also con-
tributes to comfortable analysis development. The analysis code is
not constrained to those Java features available on Android. It can
also interface directly with the common development environments,
for example for reporting results. On the DPA framework side, the
remote analysis execution requires adjusting for the differences be-
tween the DVM and the JVM platforms, in particular the difference
in the bytecode formats used by the two environments.
Motivated by the factors outlined above, the overall DPA frame-
work architecture is depicted in Figure 1. At its core is the observed
system, where the analyzed application executes in potentially mul-
tiple DVM instances. The application is instrumented to notify the
analysis about events of interest through the new event API, added
to the DVM as a part of our DVM extension. The communication
takes place through the Analysis Communication Service (ACS),
which forwards the notifications to a separate analysis server. The
instrumentation itself is done by the instrumentation server, which
takes care of injecting the code that generates event notifications into
the application as directed by the aspect-oriented analysis model.
Although the entire design is geared to deliver strong isolation
between the application and the analysis, the analysis developer
is shielded from many of the separation issues by the DPA pro-
gramming model. The model allows the developer to retain Java as
the instrumentation language, masking the fact that the application
DVM and the analysis JVM use different bytecode. The event notifi-
cations carry the necessary contextual information that allows the
analysis to identify the application components where the events
originate, to track the communication between components, and to
handle special situations such as DVM forking. We describe the
DPA programming model next, and then return to the more advanced
aspects of the DPA framework implementation.