spcl/perf-taint

Loop instrumentation fails for while(true) loops

Closed this issue · 3 comments

In the loop instrumentation, the assertion that the condition of a branch is an instruction fails for while(true) loops.

@julifan Unfortunately, I didn't succeed in reproducing the issue. Do you happen to have an MWE? Perhaps there was a different exit condition in your loop?

See the unit test: https://github.com/spcl/perf-taint/blob/master/tests/unit/dataflow/while_loop.cpp#L32

I've looked up the loop again, and actually it is a do {} while(true) loop, as in this minimal example, where the assertion also fails:

#include <stdio.h>
#include <stdlib.h>
#include <perf-taint/PerfTaint.h>

int x1 EXTRAP;

void f(int x1) 
{
  int myVar = 0;
  do {
    myVar += 1;
    if (myVar > 100) break;
  } while (true);
}

int main(int argc, char ** argv)
{
	x1 = atoi(argv[1]);
	perf_taint_register_variable(&x1, sizeof(x1), VARIABLE_NAME(x1));

	f(x1);

} 

@julifan The issue should be now fixed on master.