You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In this example, we have a C file which exports two functions (xor_static and xor_local) that each run XOR in place on output dst with input src, such that dst' = dst ^ src. Each function calls an auxiliary method _xor_aux, which copies src into a provided tmp array and then XORs dst with tmp. The only difference between the exported functions is that xor_static allocates tmp statically, whereas xor_local allocates it locally.
SAW can verify both methods without overrides, but can only apply the override for _xor_aux to verify xor_static; trying to override it for xor_local fails due to a bad pointer load...
which declares that p_tmp should be a pointer to initialized memory containing the value tmp. So when the function override runs, it tries to read the input value tmp from the pointer p_tmp. However, xor_local calls _xor_aux with a pointer to an uninitialized memory area, so the read fails. On the other hand, xor_static works because the static local tmp is compiled as a global variable, which is implicitly zero-initialized.
Everything works if you replace the above line in _xor_aux_setup with
p_tmp <- crucible_alloc (void_ptr len);
We could probably improve the error message. In particular, it would be nice if we had a little more detail than just "Invalid memory load". We should at least differentiate between loading from an out-of-bounds offset vs. reading uninitialized memory.
I'm closing, as there doesn't seem to be anything to do here. I believe the error messages for failed memory reads in llvm_verify are quite detailed now. (But feel free to reopen or make a new ticket if the error messages are still in need of improvement.)
In this example, we have a C file which exports two functions (
xor_static
andxor_local
) that each run XOR in place on outputdst
with inputsrc
, such thatdst' = dst ^ src
. Each function calls an auxiliary method_xor_aux
, which copiessrc
into a providedtmp
array and then XORsdst
withtmp
. The only difference between the exported functions is thatxor_static
allocatestmp
statically, whereasxor_local
allocates it locally.SAW can verify both methods without overrides, but can only apply the override for
_xor_aux
to verifyxor_static
; trying to override it forxor_local
fails due to a bad pointer load...The text was updated successfully, but these errors were encountered: