-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Z3 4.7.1 segfault at theory_bv.cpp:1394 during Augur contracts analysis #1766
Comments
I built Z3 in debug mode and executed again, the failure happens at https://github.com/Z3Prover/z3/blob/master/src/smt/theory_bv.cpp#L1394:
|
Getting back from offline. Can you create a log? Use z3_open_log before all else. |
Hi @NikolajBjorner thank you for looking into this issue. I was able to reproduce the issue with Z3 log enabled. Please find below the tarball with the log, it contains all the information, including Z3 build and running the Z3 analysis with segfault reproduced. Z3 log starts with "cat z3_log.txt". |
Thanks, V "4.7.1.0 Jul 26 2018" The instruction P means it is reading a pointer, previously returned by Z3 as a value to something else. |
@NikolajBjorner Oyente tool uses z3 Python bindings. I moved z3 import to the very beginning and opened z3 log right after the import.
Now the log starts with
Please find the full log attached The whole docker pre-amble was also separated out as you requested. I hope that you will be able to continue. |
looking at it. ... |
@NikolajBjorner I managed to dump sexpr() before each solver.check() call. Full log attached. It gets interesting now as I logged into the Docker container to apply changes in Oyente and executed the Oyente tool from inside Docker console. With Z3 compiled in debug mode after Z3 sassert was thrown, Z3 asked me to jump into the debugger or throw an exception, I chose the latter and the Oyente tool continued its execution. The ASSERTION VIOLATION As a side note, About the JUMPI and the Oyente itself - I am neither the author, nor maintainer of the tool, I am merely trying to fix false positive assertions returned by the tool for Augur, Ethereum-based smart contracts. JUMPI is one of the Ethereum virtual machine opcodes, and the Oyente definition for Z3 is available at https://github.com/melonproject/oyente/blob/52bf194f1da39f0de2a6e06a4c9e9452739cc3e0/oyente/opcodes.py The Oyente tool was developed in Singapore as a research project and I am not sure if it is still maintained https://www.comp.nus.edu.sg/~loiluu/papers/oyente.pdf I tried to ask them but it might be they are not that responsive due to holiday season. The original reason I got involved into this issue and discovered Z3 is that the Oyente tool returns a few false positives Assertion errors, reporting assertions in source code where assertions are not visible.
I tried to upgrade Z3 to see if it helps and encountered the segfault. I do not think that I will be able to fix those false positives, spent already too much time on this, but at least Z3 segfault could be addressed. |
I just noticed the log is missing stderr, I will execute again and paste here the relevant part. |
Surprisingly the job failed now twice in a row on a different line (786), I am pasting only the part that includes last two sexpr() dumps. |
I will now have to leave for the weekend, please let me know if you need anything else and I will add this on Monday. I could also prepare a branch of the tool that includes Z3 with a short instruction on how to reproduce the issue, perhaps it will be easier for you to jump straight into the debugger to see what happened. |
Ha, bingo, I finally hit it. The repro takes quite some time, but it is there. I will try to see what I can do in the next few days so we can close in on this when you are back. |
The timeouts exposed a bug in how bit-vectors are internalized. |
Hi @NikolajBjorner thank you for fixing this one so fast. I did not expect it will be closed over the weekend. Unfortunately, another assertion in the same Augur run popped up
I am not sure if this is related to the fix or a completely separate issue. I will prepare a branch and open another ticket for that one. |
This is most likely unrelated to the bits initialization, but likely related to handling cancellations. |
BTW, could you paste the stack? There is a slim chance this can tell me something. |
@NikolajBjorner I pasted Python stack, gdb backtrace, z3 logs and instructions into #1776 |
Switch to z3 master branch to be able to test latest Z3 fixes. Refs: Z3Prover/z3#1766
Oyente, Ethereum smart contracts analysis tool, which runs Z3 solver under the hood fails with a Z3 segfault when Z3 solver is upgraded to 4.7.1 and Oyente tool is analysing Augur smart contracts.
The segfault does not happen on Z3 4.5.0 and 4.6.0.
Steps to reproduce:
Those commands run Oyente with 4.5.0 solver:
Switching to 4.7.1 can be done with the following patch in source/support/test/oyente/Dockerfile :
Full Oyente log with segfault:
https://gist.github.com/cryptomental/c5ff857becfeda48c8c0fbb432eeba90
Verbose Oyente log including ASM dump:
https://gist.github.com/cryptomental/04e70f3b849573980814a29aa45134ac
References:
AugurProject/augur-core#689
enzymefinance/oyente#339
The text was updated successfully, but these errors were encountered: