Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Verifying programs with output #180

Open
tomsik68 opened this issue Nov 19, 2020 · 3 comments
Open

Verifying programs with output #180

tomsik68 opened this issue Nov 19, 2020 · 3 comments

Comments

@tomsik68
Copy link
Member

When verifying programs that use output like printf,puts,fprintf, Symbiotic is unable to tell the difference between output from klee and output from the verified program.

To reproduce the problem, verify memcleanup of the following program with --no-slice:

extern int printf(const char *, ...);

int main()
{
    printf("KLEE: ERROR: malicious.c:5: memory error: memory not cleaned up");
    return 0;
}

Fortunately, error replay prevents us from producing incorrect answer, but this prevents Symbiotic from answering correctly. I suggest we somehow ignore calls of these functions in klee.

tomsik68 added a commit to tomsik68/symbiotic that referenced this issue Nov 19, 2020
these could get here from program's output, see staticafi#180
tomsik68 added a commit to tomsik68/symbiotic that referenced this issue Nov 19, 2020
it could get here from program's output, see staticafi#180
@mchalupa
Copy link
Member

mchalupa commented Nov 20, 2020

I see, I know about this problem, but ignoring the calls can introduce other problems. The printf function may not only print output but also set variables ("%n" format), so we cannot entirely ignore it. The best solution would probably be to provide our implementations of such functions (which would also work generally for other verifiers than KLEE).

We can replace the pritnf call with some __symbiotic_printf that would perform the print into a string and returned the same values (and performed the side-effects) as would the print do..

@mchalupa
Copy link
Member

For KLEE, we can redirect the stdout/stderr during executing the external calls to new file descriptors (opened over /dev/stdnull for instance), so that they do not get mixed with the output of KLEE.

@tomsik68
Copy link
Member Author

I didn't think of %n, now I agree we can't just get rid of the calls. But I like the solution which redirects output to /dev/null.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants