You are on page 1of 10

Proceedings of the 35th Hawaii International Conference on System Sciences - 2002

Monitoring Software Requirements using Instrumented Code

William N. Robinson
Department of Computer Information Systems
Georgia State University
Atlanta, GA 30301-4015 USA
wrobinson@gsu.edu http://cis.gsu.edu/~wrobinso

Abstract inal software requirements did not address the full range of
Ideally, software is derived from requirements whose environmental behaviors that the software encountered.
properties have been established as good. However, it is dif- The problem is one of properly specifying requirements.
ficult to define and analyze requirements. Moreover, deriva- Perhaps, the engineers specifying the orbital insertion soft-
tion of software from requirements is error prone. Finally, ware should have worked more closely with the engineers
the installation and use of compiled software can introduce specify the orbiting software. Even so, to find the error at
errors. Thus, it can be difficult to provide assurances about design-time would require that engineers have an accurate
the state of a software's execution. model of the environment. One could say, they should have
We present a framework to monitor the requirements of known that the combination of orbital insertion calculations
software as it executes. The framework is general, and and the orbital maintenance would overcome the processing
allows for automated support. The current implementation capability of the probe. However, this is a slippery slope.
uses a combination of assertion and model checking to Eventually, one comes to see that the engineers must be able
inform the monitor. to understand all combinations of events that could occur in
We focus on two issues: (1) the expression of “suspect all environments that the software is placed. This can be
requirements”, and (2) the transparency of the software and intractable.
its environment to the monitor. We illustrate these issues As a staring point, we offer a general research question.
with the widely known problems of the Dinning Philoso- • Research question R1: How can assurances be provided
phers and the CCITT X.509 authentication. Each are repre- for running software?
sented as Java programs which are then instrumented and The research question R1 is aimed at addressing prob-
monitored. lems such as encountered by the NASA probe software.
Software development involves descriptions in the follow-
1. Introduction ing form: E, I ⇒ R. It states that, the software implementa-
tion, I, within environment E, exhibits the required
Software is pervasive. So too are software bugs. Such behaviors, R. There has been substantial supporting work in
glitches in the execution of software can cause millions of program verification. That is, providing assurances that the
dollars in lost revenue, as evidenced by recent denial of ser- software development process maintains that I ⇒ R. How-
vice attacks[16]. ever, there is less research on providing assurances that the
Sometimes the environment causes the software to act in requirements are still being satisfied within the real environ-
unpredictable ways. For example, a space probe is designed ment; that is, providing assurances that E, I ⇒ R is main-
to receive various updates as it orbits a planet. However, tained.
during orbital insertion, the probe must do many tasks—so We are currently working under the assumption that
many, that it cannot also receive updates during orbital external monitoring software can provide appropriate assur-
insertion. Unfortunately, this interaction between the orbit- ances.
ing requirements and the insertion requirements was not • Working hypothesis H1: Assurances can be provided
made apparent until a fault occurred during a mission. Yet, by monitoring the running software
We suggest the following formulation of software devel-
these are significant problems. As Lutz reports, NASA soft-
opment for requirements critical software systems: E, I, M
ware had to be “patched” post-launch due to changes in
⇒ R ∨ (¬R ∧ N). It states that, the software implementa-
requirements[27]. Many of the software requirements
tion, I, within the scope of environment E and monitor M,
changes arose due to: (1) unexpected or rare events, and (2)
exhibits the required behaviors, R, or a notification N is pro-
recovery from hardware faults or limitations. Thus, the orig-
vided. Thus, either the software does what it is intended to

0-7695-1435-9/02 $17.00 (c) 2002 IEEE 1


Proceedings of the 35th Annual Hawaii International Conference on System Sciences (HICSS-35’02)
0-7695-1435-9/02 $17.00 © 2002 IEEE
Proceedings of the 35th Hawaii International Conference on System Sciences - 2002

do, or a notification is provided, via the monitor. after the software is deployed. If testing does continue, it is
Within the scope of our requirements monitor, herein we done “at the factory”, rather than at the customer’s installa-
are concerned with two issues: (1) the expression of “sus- tion site. Yet, many software errors arise due to changing or
pect requirements”, and (2) the transparency of the software unforeseen circumstances found at the installation site. Per-
and its environment to the monitor. petual testing aims to address this gap.
Perpetual testing promises to leave the testing phase of
1.1 Expressing suspects software unbounded. Testing may continue long into
deployment, and thereby, make use of data collected during
One issue concerns the relationship between a require- the normal use of the software[5]. Currently, the perpetual
ment, R, and its notification, N. A requirement mandates testing research is addressing issues closer to software
that the system exhibit a behavior—if not, a notification design than the high-level software requirements. For exam-
should occur (e.g., R ∨ (¬R ∧ N)). Yet, we assume require- ple, Butkevich et. al., describes an extension to Java that
ments monitoring can be costly. Thus, only some, so called enables static and dynamic checking of object interaction
suspect requirements, will be marked for monitoring. protocols (i.e., sequence diagrams) as part of a Java pro-
Still, a notification that a suspect requirement failed may gram[3].
not be particularly helpful. For example, a notification that Researchers in requirements monitoring aim to fill the
“the rocket has veered into the atmosphere” may not arise in gap between requirements analysis and perpetual testing. In
time to begin an appropriate action. Instead, we prefer to requirements monitoring, systems requirements are the
allow for the monitoring of requirements and their weaken focus of study. The goal is to continually analyze require-
conditions. Thus, given that requirement satisfaction entails ments, from development through deployment to eventual
certain conditions, monitoring of those conditions seems system retirement. An important requirements monitoring
appropriate. So, if ¬R ⇒ C1⇒ C2 ⇒ C3 ... ⇒ Cn, it may activity concerns the run-time monitoring of requirements.
be helpful to be notified when Cn first occurs, when C1 later
occurs, and finally when ¬R occurs. Monitoring suspect 2.1 Execution monitoring of requirements
conditions will provide for a series of increasingly urgent
notifications prior to the failure of a requirement. Execution monitoring of requirements is a technique that
One can apply rules to generate weakened conditions tracks the run-time behavior of a system and notes when it
from requirements to serve as suspect conditions[6]. How- deviates from its design-time specification. Requirements
ever, if a condition is left out or incorrectly specified, then a monitoring is useful when it is too difficult (e.g., intractable)
requirement can still fail without warning. So, it would be to prove system properties. To aid analysis, assumptions are
helpful to automatically determine if a requirement could made as part of the requirements definition activity. The
fail, given the current state of the system. requirements and assumptions are monitored at run-time.
We will explore these issues using the two illustrative Should any such conditions fail, a procedure can be invoked
examples of sections 4 and 5. (e.g., notification to the designer). Note, such monitoring is
different from exception handling in that it: (1) considers the
1.2 Run-time environments combined behavior of events occurring in multiple threads
or processes over time, (2) links run-time behavior with the
Another monitoring issue concerns the transparency of actual design-time requirements, and (3) provides (poten-
the running software and its environment. Ideally, the moni- tially) sufficient information to allow for the run-time recon-
tor should have an accurate model of the software and its figuration of software.
environment. More likely, the software will provide a log of Fickas and Feather proposed requirements monitoring to
events that have occurred, while the environment may pro- track the satisfaction of requirements during system execu-
vide no information other than that which can be inferred tion as part of an architecture to allow the dynamic reconfig-
via the software log. In a cooperative environment, one is uration of component software[13]. Feather has produced a
more likely to adequately instrument both the required soft- working system, called FLEA, that allows one to monitor
ware and its environment. As we shall see in section 5, a events defined in a requirements monitoring lan-
competitive environment may hamper—or even purposely guage[11][12]. FLEA captures interesting events as asser-
interfere with—the progress of the monitor. tions in a database. When a monitored condition occurs, its
defined action is executed. Thus, monitoring mainly con-
2. Requirements monitoring of running sists of the translation of requirements monitoring descrip-
software tions to database triggered actions.
Fickas and Feather illustrate the execution monitoring of
Requirements analysis and software testing typically end requirements in the context of monitoring the requirements

0-7695-1435-9/02 $17.00 (c) 2002 IEEE 2


Proceedings of the 35th Annual Hawaii International Conference on System Sciences (HICSS-35’02)
0-7695-1435-9/02 $17.00 © 2002 IEEE
Proceedings of the 35th Hawaii International Conference on System Sciences - 2002

of a software license server. When the license server fails to natural language text; however, the framework assumes
satisfy its requirements (e.g., a user shall be granted a some formal definitions of desired predicates over objects
license in 90% of their requests) due to a change in the sys- and relationships. More specifically, requirements that refer
tem environment, the system notifies an administrator. to conditions on states are most easily analyzed. For exam-
Emmerich et. al. (and others [33]) have since illustrated how ple, the KAOS language can be used for this purpose[7].1
the technique may be used to monitor process compli- The following Avoid[FourHeldLeftForks] goal illus-
ance[9]; for example, organizational compliance to ISO trates one such KAOS requirement.2 The goal states that the
9000 or IEEE process descriptions[29]. system should avoid four forks, each held in a philosopher’s
Feather has gone on to analyze log files of a completed left hand. Four held left forks is bad in a system of four phi-
program[10]. Similarly, log files have been analyzed for for- losophers, as it will deadlock the system. (Section 4 presents
mal properties using a customized tool [32], as well as a col- this example problem in more detail.)
lection of state machines[1][2]. There is also related SafetyGoal Avoid[FourHeldLeftForks]
research on event-based debugging[17][21][37] and deriva- InformalDef
“Avoid four philosophers simultaneous
tion of test oracles from precise specifications [30][31]. holding their left fork.”
Girgensohn et. al. created expectation agents to monitor FormalDef
∀ p1, p2, p3, p4 : Philosopher,
the actual use of a system[14]. Developers define software f1, f2, f3, f4 :Fork
user expectations, such as, “validate the customer address  ¬ (HoldingLeft(p1,f1) ∧
HoldingLeft(p2,f2) ∧
before configuring the customer’s services”. Then, agents HoldingLeft(p3,f3) ∧
monitor the system’s use. When use of the system does not HoldingLeft(p4,f4))
match the defined expectations, “agents may perform the Monitoring the satisfaction of such high-level requirements
following actions: (1) notify developers of the discrepancy; is the purpose of the framework.
(2) provide users with an explanation based on developers’
rationale, (3) solicit a response to or comment about the 3.2 Analysis and design
expectation.”[14] In this manner, expectation agents moni-
tor the satisfaction of developer requirements (expectations) The framework assumes that the high-level software
during the system. requirements will be translated into a more development-
oriented analysis and design model. For example, the Uni-
2.2 Article overview fied Modeling Language (UML) can be used as the model-
This article describes research that builds on prior work
Define Key
in requirements monitoring. A goal of this research is to Requirements Process flow
continually analyze requirements during the run-time execu- (with information)

tion of software. Next, we present our overall requirements Information flow

monitoring framework for software execution. An important Analysis &


Design
contribution of this work concerns the continual checking of
running software. Section 4 illustrates requirement and sus-
pect condition checking with an example. The transparency
Implementation & Monitoring &
of the software and its environment are considered in sec- Instrumentation Checking
tion 5. This article concludes that a combination of assertion
checking and model checking can provide substantial sup-
port for monitoring requirements during the run-time execu-
Execution
tion of software.

3. A Requirements monitoring framework Figure 1. An illustration of a framework for run-time


requirements monitoring.
Figure 1 illustrates our requirements monitor for execut-
ing software (RMon) framework. It is essentially a refine- 1
KAOS formal definitions use temporal logic operators[28].
ment of the model described in [11]. Each of the major Here, o means in the next state. Other operators are included for
the previous state (•), some time in the future (◊), some time in
activities are described in the following subsections. the past (), always in the future (), always in the past ().
2
This goal is simply used to illustrate how a safety property
can be monitored. Here, this common example and simple goal
3.1 High-level requirements are introduced so that the reader may focus on the monitoring
framework, rather than the details of the domain. More complex
The framework relies on the description of high-level goals may be formed using linear temporal logic.For example,
one could use disjunction to define a goal of avoiding either all
software requirements. These requirements may include right or all left forks being taken.

0-7695-1435-9/02 $17.00 (c) 2002 IEEE 3


Proceedings of the 35th Annual Hawaii International Conference on System Sciences (HICSS-35’02)
0-7695-1435-9/02 $17.00 © 2002 IEEE
Proceedings of the 35th Hawaii International Conference on System Sciences - 2002

ing language. This intermediate (UML) model facilitates ing of software without source code. However, there is still
traceability between the high-level requirements and the the problem of interpreting the monitored stream. For exam-
software. Such linkage allows the execution monitor to ple, given the monitored stream of actions concerning the
compiled Java classes, methods, and variables, one must
describe software failures in terms of requirements or the
map those names back to the software requirements in order
UML model. Since developers are familiar with UML, and to interpret the actions.
it can have a direct correspondence to the software, we have
found this intermediate representation useful. However, as 3.4 Monitoring
long as one can maintain traceability between code and
The monitor must continually view the stream of (instru-
requirements, it is not necessary to have the intermediate mented) activities and interpret their meaning. It is impor-
UML model. tant that the monitor notice when the software: 1) has
violated a requirement, or 2) is about to violate a require-
3.3 Implementing and instrumenting ment, or 3) may be about to violate a requirement. However,
this can be difficult given the tiny stream of information it
The framework assumes that the high-level requirements receives. For example, the following stream is output from
will be implemented in software. Moreover, there must be an instrumented dinning philosophers program.
static traceability between the software objects and the Philosopher[0].eat()V
requirements. For example, a KAOS agent definition, such Fork[0].take()V
as the following Philosopher, can be traced to its Java class Philosopher[1].eat()V
definition. Fork[1].take()V
Philosopher[2].eat()V
// KOAS definition...
Agent Philosopher Fork[2].take()V
Has Philosopher[3].eat()V
left_fork : Fork Fork[3].take()V
right_fork: Fork
status : {ready, running, Each line is of the following format: classname[instance
suspended, dead}
number].method(parameters)returnType. No doubt, it’s not
// Java class definition (manually) derived clear (yet) that the above monitor stream shows a deadlock
KAOS definition...
class Philosopher extends Thread { of four dinning philosophers.
private Fork left;
To interpret the monitor stream, the monitor can use a
private Fork right;
In addition to the static traceability of definitions, there model. In our implementation of the RMon framework,
must be dynamic traceability of class instances. When the assertion checking is used to monitor specific suspect condi-
software executes, the monitor must be able to distinguish tions, while model checking is used in certain circumstances
the different instances of the defined classes. For example, to determine if a requirement could fail later. In both cases, a
the monitor must be able to distinguish the actions of two formal automata-based model is used. This model is gener-
instances of the same agent type (e.g., knowing that ated automatically from the Java source code.
Philosopher1 actions are different from Philosopher2 3.4.1 Assertion checking
actions). 3
A suspect condition can be considered as a system invari-
Instrumentation can enable a monitor to track the activi-
ant. That is, given ¬R ⇒ C1, one can check that C1 never
ties of relevant objects. Instrumentation is the insertion of
occurs in any state of the system. If it does, a notification
informative statements into software for the purpose of
should be generated.
monitoring. Later, when the instrumented software exe-
Consider the following suspect, ThreeHeldLeftForks.
cutes, the informative statements provide a stream of infor-
Goal Avoid[ThreeHeldLeftForks]
mation which can be interpreted by the monitor. InformalDef
Typically, the source code of software is instrumented. “Avoid three philosophers simultaneous
holding their left fork.”
However, it is also possible to instrument compiled code FormalDef
(e.g., [15]). For example, our implementation of the RMon ∀ p1, p2, p3 : Philosopher,
f1, f2, f3 :Fork
framework uses Joie to instrument Java class files (compiled  ¬ (HoldingLeft(p1,f1) ∧
Java files)[4]. HoldingLeft(p2,f2) ∧
HoldingLeft(p3,f3))
Instrumenting compiled code does provide for monitor-
Four left forks held entail three left forks held. That is,
FourHeldLeftForks ⇒ ThreeHeldLeftForks.4 So,
3 For similar reasons, Wile added the id notation to Dynamic
Acme to reason about instances distinctly from Software Archi- to provide prior warning that Avoid[FourHeldLeft-
tecture[39].

0-7695-1435-9/02 $17.00 (c) 2002 IEEE 4


Proceedings of the 35th Annual Hawaii International Conference on System Sciences (HICSS-35’02)
0-7695-1435-9/02 $17.00 © 2002 IEEE
Proceedings of the 35th Hawaii International Conference on System Sciences - 2002

Forks] may be about to fail, the monitor can check if model for violations of the specified properties.
ThreeHeldLeftForks exists. This is done by checking if To anticipate requirement failures, our implementation of
ThreeHeldLeftForks occurs during system execution. the RMon framework can model check the running pro-
gram. It does so by translating the program source code into
If,
a state-based model. As the program executes, a log of
Assert(!ThreeHeldLeftForks) events is recorded. Together, the event log and state-based
fails during any state of execution, then a notification is model represent the current state of the running program.
raised. In this way, the monitor can provide prior notifica- That monitor model can be checked to determine if the cur-
tion before a high-level requirement is violated. rent execution is on a path that can lead to a requirement
The goal Avoid[ThreeHeldLeftForks] illustrates failure.
how a weakening of a requirement may be described for Together, assertion checking and model checking are
monitoring. Of course, ThreeHeldLeftForks and many used to monitor suspect conditions and requirements. Asser-
similar suspect conditions can be specified. Deriving sus- tion checking is more efficient, but requires the (correct)
pect conditions from high-level requirements is a research specification of requirement weakenings. Model checking is
topic[6]. For example, it may be desirable to raise a warning less efficient, but does not require the specification of
when “two adjacent left forks are held”, or even “one left requirement weakenings.
fork is held”. Such suspect conditions allow for a range of 3.4.3 The monitoring procedure
warnings indicating minor to severe conditions that can lead
Our current implementation of the RMon framework is
to a requirement failure.
called ReqMon. The following procedure is used to generate
Suspect conditions may be explicitly incorporated into
a monitor and then monitor a program’s execution for
the high-level requirements. For example, rather than call
requirements failure.
Avoid[ThreeHeldLeftForks] a suspect condition, one
(1) Requirements are defined.
could consider it a high-level requirement, just as
(2) A UML model design is derived from the requirements.
Avoid[FourHeldLeftForks]is a requirement. However,
(3) A Java program is derived the UML model.5
considering all cases, even if possible, can make the require- (4) The compiled Java classes are instrumented to generate
ments, requirements analysis, and software unwieldy, if not a stream of events that the monitor can interpret.
intractable. Moreover, the resulting system would intermin- (5) Periodically, a monitor model is generated from the pro-
gle the core system and the monitor system into one non- gram source code and the monitored program event log.
cohesive system. This may impair the ability to incremen- (a)The monitored program event log is translated into
tally add functionality or monitors. Java statements that capture the sequence of method
calls in the original Java program. Thus, this “stream-
3.4.2 Model checking lined” Java source code has no loops or conditionals.
A model checking monitor can determine if a high-level It simply represents the sequence of method calls that
requirement can fail in the future without the need to explic- have occurred. In the case of multi-threading, it is
itly specify suspect conditions. Model checking is an opera- necessary to define such a sequence for each thread.
(b)To generate the state-based model, a Promela model is
tional exploration of a state-based model. Such analysis can
semi-automatically derived from the modified Java
prove that specified logic conditions will, or will not, occur source code of step 5a. A program, java2spin does this
in a modeled state of a system satisfying the requirements. translation[8].6
Thus, if the program and its current state of execution can be (c)The resulting Promela model is checked for the failure
represented as a state-based model, then the model checker of suspect conditions and requirements. To check a
can determine if a suspect requirement can fail, in any way, suspect condition, the model checker determines if
in the future. Assert(!suspect_condition) holds. (It is not
Model checking of requirements is typically applied as necessary to check the future states of a suspect condi-
follows: 1) a portion of the requirements specification is tion, since it represents a condition that leads to a re-
translated into a formal automata-based model, 2) important quirement failure; that is, ¬ R ⇒ Ci.) To check the
requirements, such as safety properties, are defined as logi- more abstract requirements, all future states of the
model are checked for each requirement. That is,
cal properties of the model, 3) a model checker (e.g.,
Spin[18]) is used to exhaustively check all states of the
5
Our current, and next, implementation use software tools that
require Java code.
4 6
If multi-threading is used, then philosophers can simulta- java2spin does not handle all Java program constructs.
neously acquire all left forks. So, there may be no recourse. Where it can, this process is fully automated. Our next version of
However, fork acquisition can be serialized through a resource ReqMon will use Java Path Finder[38]. That model check works
manager, so notification of ThreeHeldLeftForks can be directly on Java byte-code.Thus, it can model check a wider
used to prevent FourHeldLeftForks. range of program behavior.

0-7695-1435-9/02 $17.00 (c) 2002 IEEE 5


Proceedings of the 35th Annual Hawaii International Conference on System Sciences (HICSS-35’02)
0-7695-1435-9/02 $17.00 © 2002 IEEE
Proceedings of the 35th Hawaii International Conference on System Sciences - 2002

John Fork1 Anna


Thread left right
(fro m la n g )

left
ri ght

Fork2
P hilos opher Fork Fork4

is_free : boolean
- ri ght -left
P hilos opher()
eat() Fork () left right

think () tak e()


run() l eave()
Sara Fork 3 Peter
right left

Figure 2. UML class diagram representing the


Philosopher and Fork classes. Figure 3. UML collaboration diagram representing the
connections among Philosopher and Fork objects.
Never (!requirement) is determined.
(6) Failures determined in step 5 are reported by the moni- model. For example, the vUML tool can derive a Spin
tor. For both the (current) failure of a suspect condition model and present failures in terms of UML[24]. However,
or (predicted) failure of a requirement, a sequence of pro- such analysis is only available for smaller models (like the
gram states can be presented to show how the failure can dining philosophers). Larger models, entailing larger state-
occur. spaces, cannot be sufficiently explored by model checkers
(e.g., [25]). In contrast, the assertion checking (a.k.a., his-
4. Dinning philosophers tory checking) of one specific run of a program is very effi-
cient. In similar fashion, model checking for requirement
The widely known problem of the dinning philosophers
failure can be more efficient after some execution of a pro-
will serve as an exemplar for our approach to RMon frame-
gram has occurred. This occurs because as a program exe-
work. This problem is especially useful, as it demonstrates
cutes, it selects a path at each choice point, and thereby
troubles that can occur among multiple processes with
reduces the remaining state space to be checked. So, check-
shared resources.
ing suspects and requirements can be more efficient at run-
Consider four philosophers sitting around a table. The time, than design-time.
philosophers can either eat or think. Thinking does
not require a resource, whereas eating requires two Checking a program trace is still a complex process.
forks. There are only four forks; each is between a Each program state must be checked for compliance with
pair of philosophers. A philosopher can only share the linear temporal logic (LTL) formulas[28]. An LTL formula
use of forks that are immediately to his left or right.
The problem is to guarantee mutually exclusive is more abstract than a program state; it may reference
access to the forks, while preventing deadlock or star- abstract and arbitrary program states, as well as various
vation. A deadlock can occur when all philosophers lift times. Yet, a model checker can efficiently analyze any
up their left fork, and then deadlock as they try to lift
up the right fork that is already taken. properly instrumented program.
Rather than use a general model checker, one might add
4.1 High-level requirements program assertions to provide assurances about a running
program’s behavior[26]. Assertions can be complex and
The main high-level requirement we will focus on is the abstract. Program state information can be tracked by spe-
Avoid[FourHeldLeftForks] of section 3.1. In combina- cialized “assertions”, thereby allowing LTL references. In
tion with our design, it will ensure that the system will not fact, one can custom build an LTL model checker for a spe-
become deadlocked. cific program's execution using assertions. However, it is
easier, more reliable, and more general to use a general
4.2 Analysis and design checking tool for that purpose. Rather than custom tailor a
program with assertions, one can simply express LTL's and
Figure 2 shows a UML Java design model of the dinning
then automatically instrument and check the program.
philosophers. Figure 3 shows UML collaboration diagram
illustrating how the four instances of philosophers and forks
4.3 Implementing and instrumenting
are related. (The lines are links that indicate communication
among the objects.) Note that this design (and resulting Java The Java class definitions for the philosopher and fork
program) specifies the number of philosophers and forks a are shown in figure 4. The main program that executes,
priori. includes the following statements to initialize the program.
It is possible to directly model check the UML design

0-7695-1435-9/02 $17.00 (c) 2002 IEEE 6


Proceedings of the 35th Annual Hawaii International Conference on System Sciences (HICSS-35’02)
0-7695-1435-9/02 $17.00 © 2002 IEEE
Proceedings of the 35th Hawaii International Conference on System Sciences - 2002

phil1 = new Philosopher(fork1, fork2); public class TraceMixin {


phil2 = new Philosopher(fork2, fork3); // The current count of object (instances)
phil3 = new Philosopher(fork3, fork4); that are being traced.
phil4 = new Philosopher(fork4, fork1); private static int OIDcount = 0;
phil1.start(); // The object's ID.
phil2.start(); private int OID;
phil3.start();
phil4.start(); public void init () {
After the Philosopher and Fork classes were compiled, setToCurrentOIDcount();
incrementOIDcount();
they were instrumented using Joie. Figure 5 shows the Java }
class information what was added to the Philosopher and // More defintitions (elided)...
Fork classes. Notice that, as part of the mixin, an initializa- public void traceMsg(String s) {
tion method was added. This init() method tracks the spe- System.out.println(this.getClass().get-
class Philosopher extends Thread { Name() + "[" + OID + "]" + s);
private Fork left; }
private Fork right; }
Philosopher(Fork f1, Fork f2) Figure 5. The Java definition of the TraceMixin class.
{ These definitions were added to each class in the compiled
left = f1;
right = f2; class Ph1 extends Philosopher
} {
public void eat() Ph1(Fork f1, Fork f2)
{ {
left.take(); super(f1,f2);
right.take(); }
} public void run()
public void think() {
{ eat();
left.leave(); // Other steps follow here...
right.leave(); }
} }
public void run()
Figure 6. An updated Java philosopher definition for
{
philosopher 1.
while (true) {
eat(); cific instances of a class via a unique object number. This
think(); number is referenced in the traceMsg method. Thus, the val-
} ues appear in the output of section 3.4.
}
}
class Fork
4.4 Monitoring
private boolean is_free;
Fork() To monitor, the monitor program continually checks the
{ program event log. For this simple example, the program
is_free = true; event log is simply text output to standard out. (See the
} traceMsg method of figure 5.) Additionally, ReqMon also
public synchronized void take()
has a mixin that outputs the events to a database.
{ The monitor continually checks the output by creating a
while (!is_free) modified Java program and then checking it in Spin. To
try { modify the program, a program (monitorLog2Java) gener-
wait(); ates updated Java definitions from the program event log.
} catch (InterruptedException e)
{return;} Figure 6 shows an updated definition for instance number
is_free = false; one of the Philosopher class. Note, it is necessary to define
} subclasses (extends) of Philosopher because we need to
public synchronized void leave() define the prior monitored actions of an instance of the Phi-
{
is_free = true;
losopher class. The other subclasses of Philosopher (Ph1 to
notify(); Ph4) are similarly defined.
} To check the requirements on the program execution, the
} java2spin program is used to create a Promela definition of
the modified Java program. Finally, this monitor model is
Figure 4. The Philosopher and Fork Java class definition.

0-7695-1435-9/02 $17.00 (c) 2002 IEEE 7


Proceedings of the 35th Annual Hawaii International Conference on System Sciences (HICSS-35’02)
0-7695-1435-9/02 $17.00 © 2002 IEEE
Proceedings of the 35th Hawaii International Conference on System Sciences - 2002

checked. To do so, each suspect condition and requirement software and its environment to the monitor is critical.
must be added to the model. However, the Spin model Consider the CCITT X.509 (1989) protocol for signed
checker cannot understand requirement based properties, secure communication between two parties[19]. It can be
such as ThreeHeldLeftForks (§3.1). Instead, such prop- used to establish session keys that allow for authenticated
erties must be manually mapped to definitions in the under- and confidential communication. A goal of the protocol is to
lying state-based model as created by java2spin. (This can prevent the occurrence of an agent, A, sending a message to
be difficult, as the java2spin model can be non-intuitive.) an agent C, while intending to send the message to agent B.
Consider translating the ThreeHeldLeftForks sus- However, proving that this goal is always met is difficult.
pect condition. This first must be specified in terms of the The protocol has only three messages. These are illus-
monitor model definitions. In the example of our Promela trated below (in simplified form):
(Spin) model, the following terms are used. Type Message flow Nonces Signed By
#define p0HoldF0
(def_Philosopher_left[0].i_no] == 0)
Init Request B→A Kb-1
#define p1HoldF1 I A→B Na Ka-1
(def_Philosopher_left[1].i_no] == 1) II B→A Na, Nb Kb-1
#define p2HoldF2
(def_Philosopher_left[2].i_no] == 2) III A→B Nb Ka-1
#define p3HoldF3
(def_Philosopher_left[3].i_no] == 3) Above, consider A as a client and B as a server. The
#define threeHeldLeftForks sequence of messages of type I through type III causes client
((p0HoldF0 && p1HoldF1 && p2HoldF2) ||
(p0HoldF0 && p1HoldF1 && p3HoldF3) || A to be authenticated with server B.The messages use pub-
(p3HoldF3 && p1HoldF1 && p2HoldF2) ||
(p0HoldF0 && p3HoldF3 && p2HoldF2)) lic and private keys (RSA) to ensure the privacy of message
Once so defined, Spin can test for the violation of three- contents. A nonce (a unique random number depicted as Na)
HeldLeftForks, using an assertion checking process: is used to ensure that, once communication is started, no
proctype monitor() { assert(!threeHeldLeft- other agent can intervene in the two agent communication
Forks)}. protocol.
If the requirement Avoid[FourHeldLeftForks] were The CCITT X.509 protocol appears secure enough; how-
not weakened to the suspect condition threeHeldLeft- ever, it is susceptible to a reply attack.
Forks, then Avoid[FourHeldLeftForks] would have to • Replay of message to gain authentication. An imposter,
be checked directly. Moreover, we would not only want to C, can intercept messages between agents A and B so as
know if the requirement had failed, but we would also want to make B believe it is communicating with A, when it is
to know if the requirement could fail in the future. (Suspect really communicating with C. C begins the attack by cap-
conditions provide this predictive information for those con- turing and resending an old message sent from A to B.
The message is then sent from C to B.
ditions that are specified.) To determine if a requirement can
Imposter Message: I) C → B : A, { Na}Kb-1
fail, given the current state of execution, the current monitor
If the imposter’s message is sufficiently close to A’s type
model is model checked for the requirement (like three- I message to B, then B will not notice the reuse of the
HeldLeftForks shown above). message. Specifically, the reused nonce, Na, will not be
Note, model checking can involve single state-based checked, so the reuse goes undetected. Next, B will reply
properties, such as fourHeldLeftForks. However, it can with a new message intended for A.
also include temporal properties that concern sequences of Message: II) B → C: B, {Na, Nb}Kb-1
states. For example, one could check that “if property P Next, C can request that A authenticate with C. In reply
occurs, then property Q must occur in a subsequent state.” to A’s new message, C will reply with B’s nonce, Nb (the
The following section will illustrate one such analysis. type II message above). Finally, A will reply to C using
As a result of checking the assertion threeHeldLeft- the signature needed for C to send a new message to B.
Forks, a violation of the suspect condition was found for Here, we are not concerned with all the details of this attack.
the program output shown in section 3.4. Thus, as the sys- Rather, we are concerned with how it might be detected.
tem neared deadlock, the monitor detected that the require- Detecting such a flaw in the authentication protocol at
ment Avoid[FourHeldLeftForks] could fail as part of design-time is quite difficult. One must define the two coop-
the future program execution. erating agents, each of which must obey the protocol Addi-
tionally, one must define the intruder agent. It may carry out
5. Authentication any action allowed in the environment, such as the capture
and reply of messages. Once the agents and environment are
Monitoring can be an efficient means to determine represented, one can answer questions such as “Can an
requirement satisfaction. However, the transparency of the

0-7695-1435-9/02 $17.00 (c) 2002 IEEE 8


Proceedings of the 35th Annual Hawaii International Conference on System Sciences (HICSS-35’02)
0-7695-1435-9/02 $17.00 © 2002 IEEE
Proceedings of the 35th Hawaii International Conference on System Sciences - 2002

agent, A, send a message to agent C, while intending to send when two clients are authenticating with a server at the same
the message to agent B?” However, checking the effect of a time.
malicious agent on a protocol can be intractable. For exam- The critical element of the replay attack is the reuse of
ple, Josang estimates that checking the CCITT X.509 proto- the nonce, Na, by the intruder. We would like the model
col for the Replay Attack will involve approximately 1019 checker to look for an occurrence of two type I messages
states[20]. Thus, automated model checking is not practical. with the same nonce:
However, monitoring may be a practical solution. Message1(I, Nx), Message2(I, Ny) | Nx = Ny
After specifying, coding, and running the three agents However, model checkers are more appropriate for checking
(two CCITT X.509 agents and a reply attack intruder), the the occurrence of events (e.g., Assert (!generateServ-
following output was generated.
erReplyFromClient)) than the comparison of data over
Client[0].run()V
Server[0].run()V time. For such analyses, ReqMon stores a fixed buffer of the
Server[0].requestAuthorization()V program event log to a database and uses database triggers
Client[0].replyToAuthorizationRequest(LMessage;)V
Server[0].replyToTypeIRequest(LMessage;)V
to monitor for a violation.
Intruder[0].run()V
Intruder[0].generateSpoofedTypeI(LMessage;)V 6. Future research
Server[0].replyToTypeIRequest(LMessage;)V
Intruder[0].generateClientAuthorization- There are a number of directions this research is proceed-
Request(LMessage;)V
Client[0].replyToTypeIIRequestMessage(LMessage;)V ing, including the following.
Client[0].replyToAuthorizationRequest(LMessage;)V • Improve translations between requirements representa-
Intruder[0].generateReplyToClient(LMessage;)V tion and the monitor.
Client[0].replyToTypeIIRequestMessage(LMessage;)V Currently, these translations are manual (§4.4). We
Intruder[0].generateServerReplyFromClient(LMes- would like to provide some automated assistance.
sage;)V
• Improve the explanations.
Again, like the output of section 3.4, it may be difficult to A model checker can provide a trace of events showing
see, but the requirement of private communication has been how a property fails; however, these explanations must
violated. However, ReqMon can determine this requirement be translated from the monitor model back to the design
failure. or requirements model.
• Assist in the generation of suspect conditions.
The transparency of the software makes it easy to deter- Given a requirement, R, one may automatically apply
mine that the requirement has failed. Given some knowl- patterns to generate various weakened requirements,
edge of the source code, a suspect condition can be specified WR1 .. WRn[6]. Then, the failures of these suspect con-
for the case that the intruder completes the replay attack pro- ditions can be monitored to allow for a range of “warning
cess. Above, this occurs when the intruder executes the lights”.
generateServerReplyFromClient message. However, • Facilitate the evolution of a running system.
few intruders will be so helpful as to provide their source, or Eventually, we would like to provide sufficient feedback
compiled, code. to guide automate program modification as a means to
overcome systematic requirement failures.
The monitor needs to check temporal relationships
among messages in the following sequence. One could Solutions to the above issues will improve requirements
Type Message flow Nonces Signed By monitoring. As ReqMon becomes more usable, it will be
Init Request B→A Kb-1 applied to case studies. Future studies will include e-com-
I A→B Na Ka-1 merce protocols, such as the secure transaction protocol
I C→B Na Ka-1 (STP)[36].
II B→C Na, Nb Kb-1
Init Request C→A Kc-1 7. Conclusions
I A→C Na′ Ka-1
We have presented a requirements monitoring framework
II C→A Nb, Na′ Kc-1
for the monitoring of executing software. We have described
III A→C Nb Ka-1
automated tool support that simplifies the application of the
III C→B Nb Ka-1
framework. In doing so, we have described how model
checking can provide substantial support for requirements
watch for the following sequence of message types: I, II, I, monitoring.
II, III. Such a sequence results from the interleaving of a real The CCITT X.509 signed secure communication proto-
authentication and a replay attack. However, it also occurs col consists of only three messages. Yet, it illustrates how

0-7695-1435-9/02 $17.00 (c) 2002 IEEE 9


Proceedings of the 35th Annual Hawaii International Conference on System Sciences (HICSS-35’02)
0-7695-1435-9/02 $17.00 © 2002 IEEE
Proceedings of the 35th Hawaii International Conference on System Sciences - 2002

difficult it can be to prove that one has discovered all sce- (IWSSD’98), Isobe, IEEE CS Press, April, 1998.
[12] Feather, M.S., FLEA : Formal Language for Expressing Assumptions
narios for a successful attack. Requirements monitoring is a Language Description, June 25, 1997.
practical alternative to complete a prior requirements analy- [13] Fickas, S., Feather, M.S., Requirements Monitoring in Dynamic
Environments, Proceedings of the 2nd International Symposium on
sis. In particular, requirements monitoring can be an effi- Requirements Engineering, IEEE Computer Society Press, York,
cient means to provide assurances on run-time behavior. England (March 1995) 140-147.
[14] A. Girgensohn, D. Redmiles, and F. Shipman, Agent-Based Support
In the case of X.509 authentication, monitoring requires for Communication between Developers and Users in Software
knowledge of multiple agents and their message history Design. In Proceedings of the 9th Knowledge-Based Software Engi-
neering (KBSE-94) Conference, Monterey, CA: IEEE Computer
(nonce usage). Tracking this within agents via assertions Society Press, pp. 22-29, 1994.
poorly mixes individual agent protocol function with gen- [15] Han Bok Lee and Benjamin G. Zorn. BIT: A Tool for Instrumenting
Java Bytecodes. In The USENIX Symposium on Internet Technolo-
eral protocol security—a non-cohesive design. Instead, the gies and Systems, pages 73–82, 1997.
behaviors can be monitored in a separate “security agent” [16] Ann Harrison and Kathleen Ohlson, Surviving Costly Web Strikes,
ComputerWorld, IDG.com, February 21, 2000.
that relies on the sound and general reasoning of a model [17] D. Heimbold and D. Luckham. Debugging Ada tasking programs.
checker. IEEE Software, 2(2):47{57, March 1985.
[18] Holzmann, G.J., The Model Checker Spin, IEEE, Transactions on
Requirements monitoring will become a necessity as Software Engineering, 23, 1997, pp. 279-295.
more relationships are managed through on-line transac- [19] International Telecommunication Union (ITU), X.509, The Directory
- Authentication Framework, CCITT, 1989.
tions. In the past, much effort was placed on ensuring that a [20] A. Jøsang, Security protocol verification using SPIN, in J-Ch. Gre-
transaction completed properly. Thus, the two-phase com- goire, editor, Proceedings of the First SPN Workshop, INRS-Tele-
communications, Montreal, Canada, 1995
mit protocol is common place in databases. However, more [21] T. Kunz, J. Black, D. Taylor, and T. Basten. Poet: Target-system-inde-
elements of transactions are being distributed across the pendent visualizations of complex distributed-application executions.
The Computer Journal, 40(8):499{512, September 1997.
internet. This has led to protocols to ensure secure transac- [22] Leffingwell, D., Widrig, D., Managing Software Requirements: A
tions, such as STP[36]. In the future, more of us may be Unified Process, Addison Wesley Longman Inc., 2000.
[23] Leveson, N. G., Safeware: System Safety and Computers, Addison-
depending on agents that employ complex negotiation pro- Wesley Pub. Co. Inc., 1995.
tocols on our behalf[34][35]. Hence, we may also be [24] J. Lilius and I. Porres Paltor. vUML: a tool for verifying UML mod-
els. Technical Report 272, Turku Centre for Computer Science, 1999.
depending on security agents to ensure appropriate behav- [25] Johan Lilius and Iván Porres Paltor, The Production Cell: An Exercise
ior. in the Formal Verification of a UML Model, TUCS Technical Report
No. 288, May 1999
[26] D. Luckham and F. vonHenke. An Overview of Anna, a Specification
8. References language for Ada. IEEE Software, 2(2):9--22, March 1985.
[27] Lutz, R., Evolution of Safety-Critical Requirements Post-Launch,
Proceedings of the Fifth International Symposium on Requirements
[1] James H. Andrews and Yingjun Zhang, "Broad-Spectrum Studies of Engineering, IEEE, Toronto, Canada, August 27-31, 2001, (to
Log File Analysis" Proceedings of the 22nd International Conference appear).
on Software Engineering (ICSE 2000), Limerick, Ireland, June 2000. [28] Manna, Z., Prueli, A., The Temporal Logic of Reactive and Concur-
[2] J. H. Andrews. Testing using log file analysis: Tools, methods and rent Systems, Springer-Verlag 1992.
issues. In Proceedings of the 1998 International Conference on Auto- [29] Mazza, C., Fairclough, J., Melton, B., De Pablo, D., Scheffer, A.,
mated Software Engineering (ASE'98), Honolulu, Hawaii, October Stevens, R., Software Engineering Standards, Prentice Hall, 1994.
1998. [30] T. O. O'Malley, D.J.Richardson, and L. K. Dillon. Efficient specica-
[3] Sergey Butkevich, Marco Renedo, Gerald Baumgartner, and Michal tion-based oracles for critical systems. In Proceedings of the Califor-
Young, "Compiler and Tool Support for Debugging Object Protocols, nia Software Symposium, 1996.
14 pp. (OSU-CISRC-3/00-TR10), Ohio State University. [31] D. K. Peters and D. L. Parnas. Using test oracles generated from pro-
[4] Geoff Cohen, Jeff Chase, and David Kaminsky, Automatic Program gram documentation. In Proceedings of the International Symposium
Transformation with JOIE by in Proceedings of the 1998 USENIX on Software Testing and Analysis, 1984.
Annual Technical Symposium. [32] S. Qiao and H. Zhang. An automatic log le analyzer for parallel pro-
[5] Lori A. Clarke, Leon J. Osterweil, Continous Self-Evaluation for the grams. In H. R. Arabnia, editor, Proceedings of the International Con-
Self-Improvement of Software, Springer Verlag Lecture Notes in ference on Parallel and Distributed Processing Techniques and
Computer Science #1936, Proceedings of the 1st International Work- Applications, Vol. III, pages 1371{1376, Las Vegas, Nevada, USA,
shop on Self Adaptive Software (IWSAS 2000), pp. 27-29, April 1999.
2000, Oxford, England. [33] Robinson, W.N., Pawlowski, S., Managing Requirements Inconsis-
[6] Darimont, R, van Lamsweerde, A., Formal Refinement Patterns for tency with Development Goal Monitors, IEEE, Transactions on Soft-
Goal-Driven Requirements Elaboration, ACM SIGSOFT, Fourth ware Engineering, November/December, 1999.
Symposium on the Foundations of Software Engineering, San Fran- [34] Robinson, W.N., Volkov, S., Supporting the Negotiation Life-Cycle,
cisco, CA, October 16-18, 1996. ACM, Communications of the ACM, May 1998, pp. 95-102.
[7] Dardenne, A., van Lamsweerde, A., Fickas, S., Goal-Directed [35] Rosenschein, J., Zlotkin, G., Rules of Encounter, The MIT Press,
Requirements Acquisition, Science of Computer Programing, 20 1994.
1993, 3-50. [36] Douglas H. Steves, Chris Edmondson-Yurkanan, Mohamed Gouda, A
[8] C. Demartini, R. Iosif, R. Sisto A Deadlock Detection Tool for Con- Protocol for Secure Transactions, Proceedings of the Second
current Java Programs Software - Practice and Experience, Vol. 29, USENIX Workshop on Electronic Commerce (EC96) Oakland, Cali-
No. 7, July 1999, pp. 577-603, Wiley fornia, November 18-21, 1996.
[9] Emmerich, W., Finkelstein, A., Montangero, C. & Stevens, R. "Stan- [37] K.-C. Tai, R. H. Carver, and E. E. Obaid. Debugging concurrent Ada
dards Compliant Software Development" in Proc. International Con- programs by deterministic execution. IEEE Trans. Softw. Engineer-
ference on Software Engineering Workshop on Living with ing, 17(1):45{63, January 1991.
Inconsistency, (IEEE CS Press), 1997 [38] W. Visser ,K. Havelund, G. Brat and S. Park. Model Checking Pro-
[10] M. S. Feather. Rapid application of lightweight formal methods for grams. International Conference on Automated Software Engineer-
consistency analyses. IEEE Transactions on Software Engineering, ing. September 2000.
24(11), November 1998. [39] Wile, D., Residual Requirements and Architectural Residues, Pro-
[11] Feather, M.S., Fickas, S., van Lamsweerde, A., Ponsard, C., Recon- ceedings of the Fifth International Symposium on Requirements Engi-
ciling System Requirements and Runtime Behavior, Proceedings of neering, IEEE, Toronto, Canada, August 27-31, 2001, (to appear).
the International Workshop on Software Specification and Design

0-7695-1435-9/02 $17.00 (c) 2002 IEEE 10


Proceedings of the 35th Annual Hawaii International Conference on System Sciences (HICSS-35’02)
0-7695-1435-9/02 $17.00 © 2002 IEEE

You might also like