Git Product home page Git Product logo

Comments (12)

thuanpv avatar thuanpv commented on July 24, 2024

Hi,

What are your target statements? Can you please upload your BBtargets.txt file?

Best regards,

Thuan

from aflgo.

CCWANG19 avatar CCWANG19 commented on July 24, 2024

Thank you for your reply!
And my BBtargets.txt is
valid.c:2637
valid.c:2638
valid.c:2639
valid.c:2640

And I use
git checkout ef709ce2
git diff -U0 HEAD^ HEAD > $TMP_DIR/commit.diff
cat $TMP_DIR/commit.diff | $TMP_DIR/showlinenum.awk show_header=0 path=1 | grep -e ".[ch]:[0-9]:+" -e ".cpp:[0-9]:+" -e ".cc:[0-9]*:+" | cut -d+ -f1 | rev | cut -c2- | rev > $TMP_DIR/BBtargets.txt
this commond to git the BBtargets.txt file.
thank you!

from aflgo.

thuanpv avatar thuanpv commented on July 24, 2024

I figure out that the issue normally happens if LLVMgold is not installed properly. Please try to follow the installation steps in the attached file to see whether the issue is resolved. It helps some guys to resolve similar issues.
Installation_clang_4.docx

from aflgo.

zjuchenyuan avatar zjuchenyuan commented on July 24, 2024

@thuanpv I meet same issue, and I am sure that I followed just like your installation steps.

I have same questions like #48 , why do you extract $LLVM_REVISION from chromium_tools but do not use it? And why do you remove MSAN related steps?

I will build a Docker image soon. Here is my Dockerfile:

https://hub.docker.com/r/zjuchenyuan/aflgo

FROM zjuchenyuan/base

RUN apt update && \
    apt install -y sudo curl wget build-essential make cmake ninja-build git subversion python2.7 binutils-gold binutils-dev python-dev python3 python3-dev python3-pip autoconf automake libtool-bin python-bs4 libclang-4.0-dev &&\
    python3 -m pip install --upgrade pip && python3 -m pip install networkx pydot pydotplus

RUN mkdir -p /build/chromium_tools && cd /build/chromium_tools &&\
    git clone https://chromium.googlesource.com/chromium/src/tools/clang && cd .. &&\
    wget http://releases.llvm.org/4.0.0/llvm-4.0.0.src.tar.xz http://releases.llvm.org/4.0.0/cfe-4.0.0.src.tar.xz http://releases.llvm.org/4.0.0/compiler-rt-4.0.0.src.tar.xz http://releases.llvm.org/4.0.0/libcxx-4.0.0.src.tar.xz http://releases.llvm.org/4.0.0/libcxxabi-4.0.0.src.tar.xz &&\
    tar xf llvm-4.0.0.src.tar.xz && tar xf cfe-4.0.0.src.tar.xz && tar xf compiler-rt-4.0.0.src.tar.xz && tar xf libcxx-4.0.0.src.tar.xz && tar xf libcxxabi-4.0.0.src.tar.xz &&\
    mv cfe-4.0.0.src /build/llvm-4.0.0.src/tools/clang && mv compiler-rt-4.0.0.src /build/llvm-4.0.0.src/projects/compiler-rt && mv libcxx-4.0.0.src /build/llvm-4.0.0.src/projects/libcxx && mv libcxxabi-4.0.0.src /build/llvm-4.0.0.src/projects/libcxxabi &&\
    mkdir -p build-llvm/llvm; cd build-llvm/llvm &&\
    cmake -G "Ninja" \
      -DLIBCXX_ENABLE_SHARED=OFF -DLIBCXX_ENABLE_STATIC_ABI_LIBRARY=ON \
      -DCMAKE_BUILD_TYPE=Release -DLLVM_TARGETS_TO_BUILD="X86" \
      -DLLVM_BINUTILS_INCDIR=/usr/include /build/llvm-4.0.0.src &&\
    ninja && ninja install

RUN mkdir -p /build/build-llvm/msan && cd /build/build-llvm/msan &&\
    cmake -G "Ninja" \
      -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ \
      -DLLVM_USE_SANITIZER=Memory -DCMAKE_INSTALL_PREFIX=/usr/msan/ \
      -DLIBCXX_ENABLE_SHARED=OFF -DLIBCXX_ENABLE_STATIC_ABI_LIBRARY=ON \
      -DCMAKE_BUILD_TYPE=Release -DLLVM_TARGETS_TO_BUILD="X86" \
       /build/llvm-4.0.0.src &&\
    ninja cxx && ninja install-cxx

RUN mkdir /usr/lib/bfd-plugins && \
    cp /usr/local/lib/libLTO.so /usr/lib/bfd-plugins &&\
    cp /usr/local/lib/LLVMgold.so /usr/lib/bfd-plugins

RUN git clone https://github.com/aflgo/aflgo.git &&\
    cd aflgo && make all

RUN cd /aflgo/llvm_mode && make all

ENV AFLGO /aflgo

RUN apt install -y gawk pkg-config

from aflgo.

thuanpv avatar thuanpv commented on July 24, 2024

Hi @zjuchenyuan,

I have updated the aflgo-build.sh script. Please let me know if the issue is gone.

Thanks,

Thuan

from aflgo.

strongcourage avatar strongcourage commented on July 24, 2024

@zjuchenyuan: We used the oss-fuzz's script to install clang and LLVMgold plugin and AFLGo worked as expected. You can keep MSAN if you need it.

@CCWANG19: I would recommend you to use this script to install AFLGo and then use this script to fuzz libxml2. Thanks.

from aflgo.

meweez avatar meweez commented on July 24, 2024

Hi
I have the same problem with libgd:
my target is src/gd_color_match.c:35

$AFLGO/scripts/genDistance.sh $SUBJECT $TMP_DIR gdimagecolormatch
(2) Computing distance for call graph ..
cat: /home/ubuntu16/Documents/github-repos/libgd/obj-aflgo/temp/distance.callgraph.txt: No such file or directory

Parsing /home/ubuntu16/Documents/github-repos/libgd/obj-aflgo/temp/dot-files/callgraph.dot ..
Traceback (most recent call last):
  File "/home/ubuntu16/aflgo/scripts/distance.py", line 109, in <module>
    G = nx.DiGraph(nx.drawing.nx_pydot.read_dot(args.dot))
  File "<decorator-gen-714>", line 2, in read_dot
  File "/usr/local/lib/python3.5/dist-packages/networkx/utils/decorators.py", line 214, in _open_file
    fobj = _dispatch_dict[ext](path, mode=mode)
FileNotFoundError: [Errno 2] No such file or directory: '/home/ubuntu16/Documents/github-repos/libgd/obj-aflgo/temp/dot-files/callgraph.dot'
-- Problem in Step 2 of generating !
-- You can resume by executing:
$ /home/ubuntu16/aflgo/scripts/genDistance.sh /home/ubuntu16/Documents/github-repos/libgd /home/ubuntu16/Documents/github-repos/libgd/obj-aflgo/temp gdimagecolormatch /home/ubuntu16/Documents/github-repos/libgd/obj-aflgo/temp

I have a lot of dot file for cfg in my dot-file folder but i don't have callgraph.
I reinstall LLVMgold but again I don't have callgraph :(

I figure out that the issue normally happens if LLVMgold is not installed properly. Please try to follow the installation steps in the attached file to see whether the issue is resolved. It helps some guys to resolve similar issues.
Installation_clang_4.docx

from aflgo.

strongcourage avatar strongcourage commented on July 24, 2024

Hi @peach-byte,
I try the latest version 2.2.5 of libgd. Given your target gd_color_match.c:35, the file Ftargets.txt is empty. Thus, I change this file a bit, now the BBtargets.txt contains gd_color_match.c:37 (maybe you used another version and did not have this issue).

The generated Ftargets.txt contains the function gdImageColorMatch as expected, however I have the same issue as yours since the callgraph in dot does not have the node gdImageColorMatch, consequently AFLGo could not generate the file distance.callgraph.txt.

You should probably try different targets. Best.

from aflgo.

meweez avatar meweez commented on July 24, 2024

Thank you for reply.
although my Ftargets.txt is not empty I don't have callgraph dot file at all.
my head is this commit:
2e886046f86d0d6bfc14aab94a881259a081e3f4

I used these command :

export CC=$AFLGO/afl-clang-fast
export CXX=$AFLGO/afl-clang-fast++
export COPY_CFLAGS=$CFLAGS
export COPY_CXXFLAGS=$CXXFLAGS
export ADDITIONAL="-targets=$TMP_DIR/BBtargets.txt -outdir=$TMP_DIR -flto -fuse-ld=gold -Wl,-plugin-opt=save-temps"
export CFLAGS="$CFLAGS $ADDITIONAL"
export CXXFLAGS="$CXXFLAGS $ADDITIONAL"
export LDFLAGS=-lpthread
./bootstrap.sh 
./configure --disable-shared
make check

I use make check because i want to fuzz from gdimagecolormatch.c

am I right in these steps?

Hi @peach-byte,
I try the latest version 2.2.5 of libgd. Given your target gd_color_match.c:35, the file Ftargets.txt is empty. Thus, I change this file a bit, now the BBtargets.txt contains gd_color_match.c:37 (maybe you used another version and did not have this issue).

The generated Ftargets.txt contains the function gdImageColorMatch as expected, however I have the same issue as yours since the callgraph in dot does not have the node gdImageColorMatch, consequently AFLGo could not generate the file distance.callgraph.txt.

You should probably try different targets. Best.

from aflgo.

strongcourage avatar strongcourage commented on July 24, 2024

I used your version, run make check, then I used a different commands as follows:

cd tests/gdimagecolormatch
$AFLGO/scripts/genDistance.sh $SUBJECT $TMP_DIR gdimagecolormatch

So given BBtargets.txt gd_color_match.c:36, I can generate distance.callgraph.txt but distance.cfg.txt is empty :). You can find the folder temp.zip.

To fuzz gdimagecolormatch, you still need to choose appropriate targets. Best.

from aflgo.

meweez avatar meweez commented on July 24, 2024

cd tests/gdimagecolormatch
$AFLGO/scripts/genDistance.sh $SUBJECT $TMP_DIR gdimagecolormatch

why distance.cfg.txt is empty?
I review step2.log file but no useful information.

from aflgo.

strongcourage avatar strongcourage commented on July 24, 2024

I don't know, maybe due to a bug in the script.

from aflgo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.