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

Adding oss-fuzz to libffi #523

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Adding oss-fuzz to libffi #523

wants to merge 1 commit into from

Conversation

k2naveen
Copy link

Adding initial changes to support oss-fuzz in libffi (Ref #292 .

Steps to enable fuzzing in libffi:
git clone https://github.com/libffi/libffi.git
cd libffi
./autogen.sh
./configure CC=clang CXX=clang++ LD=clang++ --enable-fuzzing LDFLAGS=-lffi --prefix=/path/to/precompiled/libffi.so/
make
./x86_64-pc-linux-gnu/ffi_strlen_fuzzer
or
./x86_64-pc-linux-gnu/ffi_strlen2_fuzzer

Build integration to osss-fuzz is in-progress. Please review & provide your feedback.

@atgreen
Copy link
Member

atgreen commented Oct 17, 2019

Thanks, Naveen.

After looking at your sample programs, I'm not sure what value fuzzing has for libffi. As far as I can tell, these are really testing strlen, because the libffi code paths are always the same -- regardless of input provided by libFuzz. What do you think?

@k2naveen
Copy link
Author

Hi @atgreen,
The sample code is based on libffi.call testsuites and it is just a simple use case of libfuzz.
Do you think we can utilize libfuzz’s Fuzz Testing in the libffi in a better way? Please give your inputs.

BTW, I created a separate directory under src/fuzz for the libfuzz.

@DemiMarie
Copy link

@atgreen One way to fuzz libffi would be:

  1. Generate random function signatures.
  2. Compile, link, and dlopen() a shared library with a function with that signature.
  3. Call the function.
  4. Check that the result is what is expected.

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

Successfully merging this pull request may close these issues.

3 participants