Closed vannussina closed 10 months ago
Could you please provide the bc file and the related options you used for Titan?
Sure! Basically this is part of my build script for the target until the static analysis:
# Generate bitcode file
echo -e "## Build by wllvm"
export CC="wllvm"
export CXX="wllvm++"
export CFLAGS="-g"
export CXXFLAGS="-g"
export LLVM_COMPILER=clang
pushd $SUBDIR
./autogen.sh
./configure --disable-shared
make clean
make
popd
extract-bc "$SUBDIR/src/flex"
# Build for Titan
echo "[+] Static Analysis"
$FUZZ/prototype/precondInfer "$SUBDIR/src/flex.bc" --target-file=$SEED/cstest.txt --join-bound=1 > "$OUT/log_precond.txt" 2>&1
The logfile shows that target extraction works fine until it dies in the first fixpoint computation:
Starting fixpoint computation for buf_prints
0
and then there's the segfault. This is the bc file: flex.zip
@vannussina I am unable to reproduce using 1fb90fffa4402. The provided target file causes beacon to exit with malformed target file -- exiting!
. Which version of the code are you testing? Thanks.
The target file was for Titan, which supports multi-targeting. Beacon doesn't support multi-targets, so I suppose that's why it failed. I just posted this here because I analyzed Beacon's PrecondInfer as it's only in binary form in the Titan repo. In the mentioned Titan issue above I attached all files from the out folder as well for another target where I came across the issue.
@vannussina f5489224ec39aed3 fixes the crash.
The problem is that our ICFG fails to identify any caller of the target function. This could either due to that the target is indeed unreachable or the function pointer analysis (based on SVF) is unsound. The latter case needs to be visited case by case.
For instance, no callers for buf_prints
are found by the static analysis. If you have identified a caller of it at run time, then we can also try to fix the call graph to make it more sound.
@vannussina We will soon update the code for Titan, too.
update: I have examine the bitcode flex.bc
. It seems that buf_prints
is indeed unreachable. I think this specific issue is fixed.
Thanks! I'll check again with my targets as soon as the Titan repo is updated.
Thank you for bringing this matter to our attention:)
We have made updates to Titan's code based on this issue, and the precondInfer
now handles your bc file.
If you have any further questions or encounter any issues, please feel free to reach out to us.
Thanks for the quick fix! I checked and now it works! 👍
Just one more quick question: I realized that the file bbreaches.txt
now was renamed to bbreaches__path_to_cstest.txt
. Is the file of any importance for the instrumentation or fuzzing process? Or ist ist just for debug purposes and I can ignore it?
@vannussina Yes. The filename can be ignored as it doesn't impact the functionality :)
Hi, when I used Titan for one of my fuzzing targets, the static analysis crashed with a segfault. As the
precondInfer
is inherited by Beacon, I'm posting this here. With some further investigation I found out that the crash appeared in fileAbstractState.cpp
, line 236 in functionAbstractState::set
:gdb
showed that variableplaceHodler
is a nullpointer, which is then dereferenced in the next line causing the segfault. The CPP reference states for cases as this that "If the container is empty, the returned iterator value shall not be dereferenced." which is the case here. I am not sure, whyvalKeys
is empty though and if this might be an error in my configuration, but the other targets worked just fine so far.My fuzzing target was flex with the following cstest.txt: