adapt experiments to new restore() behavior

This change adapts several experiments, including the
DatabaseExperiment framework, to the restore() behavior update from
the previous change.  Existing traces should continue to be usable.

This is not tested yet, mainly because I don't have access to most of
the experiment targets / guest systems necessary for testing.  Please
test your own experiments if possible, or at least leave me a note
that you couldn't test it!

Especially the cored-voter/experiment.cc update may be broken, but
maybe the "FISHY" +2 in there was not OK in the first place.

Change-Id: I0c5daeabc8fe6ce0c3ce3e7e13d02195f41340ad
This commit is contained in:
Horst Schirmeier
2015-03-18 18:16:47 +01:00
parent 91a9c6f688
commit 193e5b757e
8 changed files with 42 additions and 39 deletions

View File

@ -109,19 +109,19 @@ bool DatabaseExperiment::run()
simulator.clearListeners(); simulator.clearListeners();
// Generate an experiment listener, that matches on any IP
// event. It is used to forward to the injection
// point. The +1 is needed, since even for the zeroth
// dynamic instruction we need at least one breakpoint
// event.
BPSingleListener bp;
bp.setWatchInstructionPointer(ANY_ADDR);
bp.setCounter(injection_instr + 1);
simulator.addListener(&bp);
if (!this->cb_before_fast_forward()) { if (!this->cb_before_fast_forward()) {
continue; continue;
} }
// Do we need to fast-forward at all?
if (injection_instr > 0) {
// Create a listener that matches any IP event. It is used to
// forward to the injection point.
BPSingleListener bp;
bp.setWatchInstructionPointer(ANY_ADDR);
bp.setCounter(injection_instr);
simulator.addListener(&bp);
fail::BaseListener * listener; fail::BaseListener * listener;
while (true) { while (true) {
listener = simulator.resume(); listener = simulator.resume();
@ -133,6 +133,7 @@ bool DatabaseExperiment::run()
break; // Stop fast forwarding break; // Stop fast forwarding
} }
} }
}
if (!this->cb_after_fast_forward(listener)) { if (!this->cb_after_fast_forward(listener)) {
continue; // Continue to next injection experiment continue; // Continue to next injection experiment
} }

View File

@ -321,19 +321,23 @@ bool CoredTester::run() {
simulator.addListener(&l_fail_trace); simulator.addListener(&l_fail_trace);
BPSingleListener bp; BPSingleListener bp;
fail::BaseListener *listener = 0;
bool ok = true;
// do we have to fast-forward at all?
if (injection_instr > 0) {
bp.setWatchInstructionPointer(ANY_ADDR); bp.setWatchInstructionPointer(ANY_ADDR);
// TODO: why does this need a +1? bp.setCounter(injection_instr);
bp.setCounter(injection_instr+1);
simulator.addListener(&bp); simulator.addListener(&bp);
fail::BaseListener * listener = simulator.resume(); listener = simulator.resume();
bool ok = true;
while ( ok && (listener == &l_fail_trace) ) { while ( ok && (listener == &l_fail_trace) ) {
// m_log << "CP IP 0x" << std::hex << simulator.getCPU(0).getInstructionPointer() << std::endl; // m_log << "CP IP 0x" << std::hex << simulator.getCPU(0).getInstructionPointer() << std::endl;
ok = cpoint.check(s_fail_trace, l_fail_trace.getTriggerInstructionPointer()) == Checkpoint::IDENTICAL; ok = cpoint.check(s_fail_trace, l_fail_trace.getTriggerInstructionPointer()) == Checkpoint::IDENTICAL;
if(ok) listener = simulator.addListenerAndResume(&l_fail_trace); if(ok) listener = simulator.addListenerAndResume(&l_fail_trace);
} }
}
unsigned experiment_number = cpoint.getCount(); unsigned experiment_number = cpoint.getCount();
@ -347,7 +351,7 @@ bool CoredTester::run() {
break; break;
} }
if (listener != &bp) { if (listener != &bp && injection_instr > 0) {
result = param.msg.add_result(); result = param.msg.add_result();
handleEvent(*result, result->NOINJECTION, "WTF"); handleEvent(*result, result->NOINJECTION, "WTF");

View File

@ -349,11 +349,11 @@ bool CoredVoter::run() {
// Fast forward to injection address // Fast forward to injection address
m_log << "Trying to inject @ instr #" << dec << injection_instr << endl; m_log << "Trying to inject @ instr #" << dec << injection_instr << endl;
if ((injection_instr + 2) > 0) { if (injection_instr > 0) {
simulator.clearListeners(); simulator.clearListeners();
BPSingleListener bp; BPSingleListener bp;
bp.setWatchInstructionPointer(ANY_ADDR); bp.setWatchInstructionPointer(ANY_ADDR);
bp.setCounter(injection_instr + 2); // FIXME: FISHY! bp.setCounter(injection_instr);
simulator.addListener(&bp); simulator.addListener(&bp);
fail::BaseListener * listener = simulator.resume(); fail::BaseListener * listener = simulator.resume();

View File

@ -197,7 +197,7 @@ bool DCIAOKernelStructs::run() {
simulator.addListener(&l_time_marker_print); simulator.addListener(&l_time_marker_print);
bp.setWatchInstructionPointer(ANY_ADDR); bp.setWatchInstructionPointer(ANY_ADDR);
bp.setCounter(injection_instr+1); bp.setCounter(injection_instr);
simulator.addListener(&bp); simulator.addListener(&bp);
// Add vport listener // Add vport listener

View File

@ -253,7 +253,7 @@ bool FiascoFailExperiment::faultInjection()
if(instr_offset > 0) if(instr_offset > 0)
{ {
bp.setWatchInstructionPointer(ANY_ADDR); // Create new Breakpoint... bp.setWatchInstructionPointer(ANY_ADDR); // Create new Breakpoint...
bp.setCounter(instr_offset + 1); // ...to break when the IP for the fault injection is reached... bp.setCounter(instr_offset); // ...to break when the IP for the fault injection is reached...
simulator.addListener(&bp); // ...and add it to the actual listeners simulator.addListener(&bp); // ...and add it to the actual listeners
BaseListener *go = waitIOOrOther(true); // Resume simulation and log VGA-Output BaseListener *go = waitIOOrOther(true); // Resume simulation and log VGA-Output

View File

@ -187,8 +187,7 @@ bool KESOgc::run()
BPSingleListener bp; BPSingleListener bp;
bp.setWatchInstructionPointer(ANY_ADDR); bp.setWatchInstructionPointer(ANY_ADDR);
// Fix offset by 1 error bp.setCounter(injection_instr);
bp.setCounter(injection_instr + 1);
simulator.addListener(&bp); simulator.addListener(&bp);

View File

@ -161,7 +161,7 @@ bool KESOrefs::run()
BPSingleListener bp; BPSingleListener bp;
bp.setWatchInstructionPointer(ANY_ADDR); bp.setWatchInstructionPointer(ANY_ADDR);
bp.setCounter(injection_instr + 1); bp.setCounter(injection_instr);
simulator.addListener(&bp); simulator.addListener(&bp);
bool inject = true; bool inject = true;

View File

@ -160,8 +160,7 @@ bool VEZSExperiment::run()
BPSingleListener bp; BPSingleListener bp;
bp.setWatchInstructionPointer(ANY_ADDR); bp.setWatchInstructionPointer(ANY_ADDR);
// Fix offset by 1 error bp.setCounter(injection_instr);
bp.setCounter(injection_instr + 1);
simulator.addListener(&bp); simulator.addListener(&bp);