verse-lab/sisyphus

Update Dynamic Trace Analysis to work with mutli-file OCaml projects

Closed this issue · 1 comments

The current implementation of the dynamic trace analysis is mostly a hack that I threw together for testing but probably needs to be reworked to work correctly for arbitrary OCaml binaries.

Currently, we print out the program, instrumented with calls to print the state of the heap at intermediate points, and then call OCaml on the code:

  let generate_trace str : state list =
    let open Bos in
    OS.Cmd.run_io Cmd.(v "ocaml" % "-stdin") (OS.Cmd.in_string str)
    |> OS.Cmd.out_string |> Result.get_exn |> fst |> Fun.flip Marshal.from_string 0

This was good enough for testing whether the idea of trace based program alignment would work at all, but quickly falls flat when we start working with any program of non-trivial size, as they may not be a single file.

Relevant links:
https://discuss.ocaml.org/t/pass-ocaml-values-to-and-from-ocaml-code-evaluated-at-runtime