c4-project / c4f

The C4 Concurrent C Fuzzer
MIT License
13 stars 1 forks source link

Idea: streamlined fuzzer paths #153

Closed MattWindsor91 closed 4 years ago

MattWindsor91 commented 4 years ago

The current path setup involves quite a lot of types, roughly one per control flow concept. If we add fuzzer actions that manipulate while, do-while, for, and other C constructs, the amount of path types is going to explode. Since all of them are basically either indexing into a particular item in an AST node or saying 'focus on this node', I wonder if they can be replaced with something simpler.

My immediate thought is that a path is a list of pairs of the form (int, int), where each first int is an index into the current AST node, and the second int is a length that, when nonzero, specifies that the path is operating on a range of items.

What maps onto which index would be node-specific, but might be something like this:

Given the example program

void P1(int *x, int *y)
{
  int foo;
  *x = 50;
  if (*y == 42) {
    foo = 9;
  } else {
    foo = 10;
    *x = 6;
  } 
  *y = foo;
}

One possible disadvantage of this encoding might be that fuzzer traces and errors are harder to read out, as the trace now needs some manual mapping back to the AST. Maybe there's a nice halfway house.

MattWindsor91 commented 4 years ago

I've gone off this idea quite a bit tbh, so I'm closing it for now =P