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

Unable to find target in callgraph when fuzzing Apache httpd #2

Closed
cty12 opened this issue Sep 5, 2017 · 9 comments
Closed

Unable to find target in callgraph when fuzzing Apache httpd #2

cty12 opened this issue Sep 5, 2017 · 9 comments

Comments

@cty12
Copy link

cty12 commented Sep 5, 2017

Fuzzing target

Apache httpd

Patched used

The patch for CVE-2016-2161.

Httpd version

Commit 5da25a4

Aflgo version

Compiled from the latest commit on master branch.

Issue description

Unable to find the targets in $TMP_DIR/Ftarget.txt in the callgraph (dot-files/callgraph.dot).

@aflgo
Copy link
Owner

aflgo commented Sep 6, 2017

Thanks for your issue report!

Let me ask you a few questions:

  • What is your LLVM version?
  • Did you set the appropriate CC, CXX, CFLAGS, CXXFLAGS and install the GOLD plugin?
  • Does the compilation complete successfully?
  • Is 'Ftarget.txt' empty?
    • If yes, are 'BBnames.txt', 'BBcalls.txt', and 'Fnames.txt' empty as well?
    • If not, can you grep for a target function name in the 'dot-files/callgraph.dot' and see if it exists?

@cty12
Copy link
Author

cty12 commented Sep 6, 2017

Thank you for your reply.

  1. aflgo-compiler 2.49b
  2. Yes.
tianyu@ubuntu-vm0:~/app$ echo $CC $CXX
/home/tianyu/aflgo/afl-clang-fast /home/tianyu/aflgo/afl-clang-fast++
tianyu@ubuntu-vm0:~/app$ echo $CFLAGS $CXXFLAGS 
-targets=/home/tianyu/app/temp/BBtargets.txt -outdir=/home/tianyu/app/temp -fuse-ld=gold -flto -Wl,-plugin-opt=save-temps -targets=/home/tianyu/app/temp/BBtargets.txt -outdir=/home/tianyu/app/temp -fuse-ld=gold -flto -Wl,-plugin-opt=save-temps
  1. Yes.
  2. Ftargets.txt is not empty:
initialize_module
gen_client
initialize_module
gen_client

The exact problem is that we cannot find the target function in dot-files/callgraph.dot.

@aflgo
Copy link
Owner

aflgo commented Sep 7, 2017

Can you report the output of the following commands?

  1. clang --version to check LLVM version
  2. ld -plugin /path/to/LLVMgold.so to check whether Gold plugin works. The Gold plugin is used to generate the bitcode file (*.bc) for the compiled binaries. The bitcode file is used only to extract the callgraph. Once everything is integrated into a single LLVM pass, Gold and the generation of *.dot files will be redundant.
  3. grep initialize_module dot-files/callgraph.dot. If empty,
    • can you try to locate the bitcode for the main binary (e.g., httpd.0.0.*.bc), and
    • execute opt -dot-callgraph <path-to-main.binary.bc> >/dev/null?
    • This regenerates the callgraph.dot in the current folder: grep initialize_module callgraph.dot.

@legend-issue
Copy link

I used libxml2 to make an example,but after I build libxml2,I found Ftargets.txt and BBcalls are empty

@thuanpv
Copy link
Collaborator

thuanpv commented Oct 30, 2017

Hi,
Can you please provide more information like what version of libxml2 you are testing and how do you specify the target(s) -- you test a specific patch or you set the targets manually?

You can check your "step*.log" and "state" files inside your temporary folder ($TMP_DIR) to see whether there is some trivial error there.

Please also report the output of the following commands:

  1. clang --version to check LLVM version
  2. ld -plugin /path/to/LLVMgold.so to check whether Gold plugin works. The Gold plugin is used to generate the bitcode file (*.bc) for the compiled binaries. The bitcode file is used only to extract the callgraph. Once everything is integrated into a single LLVM pass, Gold and the generation of *.dot files will be redundant.

Thuan

@legend-issue
Copy link

legend-issue commented Oct 31, 2017 via email

@thuanpv
Copy link
Collaborator

thuanpv commented Oct 31, 2017

Hi Oscar,
Do you see any log file (step*.log) in your $TMP_DIR? If so, please share it with me for a quick look.
Thuan

@legend-issue
Copy link

legend-issue commented Oct 31, 2017 via email

@thuanpv
Copy link
Collaborator

thuanpv commented Oct 31, 2017

Hi,
The targets can be generated automatically from code changes as shown in Readme.md. You can also specify targets manually or using some other tools -- a static analysis tool for example, just ensure that you follow the format as in BBtargets.txt.

Thuan

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

4 participants