SRI-CSL / OCCAM

OCCAM: Object Culling and Concretization for Assurance Maximization
BSD 3-Clause "New" or "Revised" License
26 stars 10 forks source link

Unexpected output with specialized binary: grep #58

Closed muhammad-muzammil closed 3 years ago

muhammad-muzammil commented 3 years ago

The Linux application "grep", after specialization with OCCAM, produces an output that is inconsistent with the output of the original "grep" application. Even though the functionality works correctly, the output has an extra string attached at the start of the output. For example: original "grep" output for the command: grep -v "hello" files/sum Binary file files/sum matches specialized "grep" output for the command: ./grep_slash_v files/sum: binary file matches Where sum is a text file in the files/ directory.

This error can be reproduced by following these steps:

  1. run ./build.sh
  2. run the specialized application produced and compare the output with the original application output

The required files can be found here.

caballa commented 3 years ago

I think you are comparing the grep installed in your system with the specialized binary produced by OCCAM. But you should compare the specialized binary with the grep binary that you included in the zip.

./grep -v "hello" /homes/jorge/Repos/OCCAM-10/issue58/sum
./grep: /homes/jorge/Repos/OCCAM-10/issue58/sum: binary file matches

If I try the grep binary installed in my system I get:

grep -v "hello" /homes/jorge/Repos/OCCAM-10/issue58/sum
Binary file /homes/jorge/Repos/OCCAM-10/issue58/sum matches

Note the difference between calling ./grep and grep. The output with the specialized binary produced by OCCAM is:

./grep_occamized 
./grep_occamized: /homes/jorge/Repos/OCCAM-10/issue58/sum: binary file matches
caballa commented 3 years ago

I'll close it for now. Feel free to reopen it if I miss something.