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

fuzzer: Add evmone-fuzzer for EVMC VMs #162

Merged
merged 1 commit into from
Sep 11, 2019
Merged

fuzzer: Add evmone-fuzzer for EVMC VMs #162

merged 1 commit into from
Sep 11, 2019

Conversation

chfast
Copy link
Member

@chfast chfast commented Sep 10, 2019

This is not build on CI. This might be done later. But I'm using this code locally all the time and is quite stable now (I rarely do changes there) so it's good time to put it in the repo finally.

cc @cryptomental

@chfast chfast mentioned this pull request Sep 10, 2019
@codecov-io
Copy link

codecov-io commented Sep 10, 2019

Codecov Report

Merging #162 into master will decrease coverage by 1.11%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           master     #162      +/-   ##
==========================================
- Coverage   90.21%   89.09%   -1.12%     
==========================================
  Files          21       21              
  Lines        2237     2237              
  Branches      218      217       -1     
==========================================
- Hits         2018     1993      -25     
- Misses        192      217      +25     
  Partials       27       27

@cryptomental
Copy link

I will do the review and test it today evening.

@cryptomental
Copy link

Hi @chfast do you have a Docker image handy to build it?

I could not build the evmone with -DEVMONE_FUZZING=ON and -DEVMONE_FUZZING_COVERAGE on my vanilla Ubuntu 18.04 LTS and clang 6 yesterday, neither Debian Buster and clang 7, for some reason apt.llvm.org is down today and I could not get the latest clang 9 to verify that...

I tried to build with

FROM debian:buster as evmone_fuzzer

RUN apt-get update -q && apt-get install -qy g++ cmake make software-properties-common git sudo build-essential wget curl

ADD . /src

RUN apt-get update && apt-get install -y clang lldb lld clang-tools

RUN mkdir /build && cmake -S /src -B /build -DEVMONE_FUZZING=ON -DEVMONE_FUZZING_COVERAGE=ON

ENV CC=clang
ENV CXX=clang++
RUN cmake --build /build --target evmone-fuzzer

ENTRYPOINT ["/bin/bash"]

fails with

...
 ---> Running in 60460de8ce49
Scanning dependencies of target instructions
[  8%] Building C object evmc/lib/instructions/CMakeFiles/instructions.dir/instruction_metrics.c.o
[ 16%] Building C object evmc/lib/instructions/CMakeFiles/instructions.dir/instruction_names.c.o
[ 25%] Linking C static library libevmc-instructions.a
[ 25%] Built target instructions
Scanning dependencies of target testutils
[ 33%] Building CXX object test/utils/CMakeFiles/testutils.dir/utils.cpp.o
c++: error: unrecognized command line option '-fprofile-instr-generate'; did you mean '-fprofile-generate'?
c++: error: unrecognized command line option '-fcoverage-mapping'; did you mean '-Wcoverage-mismatch'?
make[3]: *** [test/utils/CMakeFiles/testutils.dir/build.make:63: test/utils/CMakeFiles/testutils.dir/utils.cpp.o] Error 1
make[2]: *** [CMakeFiles/Makefile2:423: test/utils/CMakeFiles/testutils.dir/all] Error 2
make[1]: *** [CMakeFiles/Makefile2:745: test/fuzzer/CMakeFiles/evmone-fuzzer.dir/rule] Error 2
make: *** [Makefile:340: evmone-fuzzer] Error 2
The command '/bin/sh -c cmake --build /build --target evmone-fuzzer' returned a non-zero code: 2

@chfast
Copy link
Member Author

chfast commented Sep 11, 2019

Set -DEVMONE_FUZZING_COVERAGE=OFF. This one is only needed to check source code coverage after you have the corpus.

@cryptomental
Copy link

With help from @chfast I was able to build and run with ethereum/cpp-build-env Docker image.

FROM ethereum/cpp-build-env

ADD . /src

ENV CC=clang
ENV CXX=clang++
RUN mkdir /home/builder/build && cmake -S /src -B /home/builder/build -DEVMONE_FUZZING=ON -DEVMONE_TESTING=ON
RUN cmake --build /home/builder/build --target evmone-fuzzer

ENTRYPOINT ["/bin/bash"]

I had a look at the contents and the PR looks reasonable for merging.

@chfast chfast merged commit daa9f3e into master Sep 11, 2019
@chfast chfast deleted the fuzzing branch September 11, 2019 10:44
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