jazzer icon indicating copy to clipboard operation
jazzer copied to clipboard

Improve documentation for Mac OS users

Open marco-schmidt opened this issue 3 years ago • 4 comments

I'd like to try jazzer with my Java library under Mac OS and have already created a target class: https://github.com/marco-schmidt/ufxcoder/blob/master/src/main/java/ufxcoder/formats/JazzerTarget.java

I've also followed your README.md and installed bazel.

I don't understand what do next. It seems like there are no released binaries for Mac OS and bazel is required to compile them. However, the documented bazel calls are for Linux as far as I can see.

Could you include a small guide on what to do as a Mac user? Or point me to a section in the README I may have overlooked?

If someone has time to run jazzer on my library, I've added the build and jazzer call which I think should work to the target class: https://github.com/marco-schmidt/ufxcoder/blob/bf14f126e963620275f59106e068448d3bafd5a9/src/main/java/ufxcoder/formats/JazzerTarget.java#L30

Thanks for any feedback and for providing jazzer, Marco

marco-schmidt avatar May 31 '21 00:05 marco-schmidt

I agree that the installation instructions for macOS were less than ideal. I don't own a macOS device myself and thus can't test binaries, but have improved the instructions in #128. If you encounter any issues while going through the steps, please update this issue and I will try to be of help.

I tried running the command at https://github.com/marco-schmidt/ufxcoder/blob/bf14f126e963620275f59106e068448d3bafd5a9/src/main/java/ufxcoder/formats/JazzerTarget.java#L30 and it worked well after a small fix: The jar files live in a lib subdirectory of build/install/ufxcoder on my machine.

The target produces quite a few log line of the form

09:37:27.884 [main] DEBUG ufxcoder.formats.jpeg.JpegProcessor - 2 ffc4 40

Fuzzing should be faster if there is a way to disable them.

fmeum avatar May 31 '21 07:05 fmeum

@fmeum Thanks for your quick response. I could follow the new guide easily, but running jazzer fails in the compilation stage on my machine:

$ ../../tools/bazelisk-darwin run //:jazzer -- --cp=... [lengthy arguments snipped]
INFO: Analyzed target //:jazzer (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
INFO: From Compiling absl/strings/internal/utf8.cc:
warning: unknown warning option '-Wno-implicit-int-float-conversion'; did you mean '-Wno-implicit-float-conversion'? [-Wunknown-warning-option]
1 warning generated.
...
ERROR: /Users/marco/dev/code/jazzer/driver/BUILD.bazel:4:11: Compiling driver/sanitizer_hooks_with_pc.cpp failed: (Exit 1): cc_wrapper.sh failed: error executing command external/local_config_cc/cc_wrapper.sh -U_FORTIFY_SOURCE -fstack-protector -Wall -Wthread-safety -Wself-assign -fcolor-diagnostics -fno-omit-frame-pointer -g0 -O2 '-D_FORTIFY_SOURCE=1' -DNDEBUG ... (remaining 22 argument(s) skipped)

Use --sandbox_debug to see verbose messages from the sandbox
driver/sanitizer_hooks_with_pc.cpp:51:16: error: 'asm goto' constructs are not supported yet
  asm volatile goto(
               ^
1 error generated.
Target //:jazzer failed to build

As for the dependencies mentioned under Using Bazel on my machine:

$ clang --version
Apple clang version 11.0.0 (clang-1100.0.33.16)
Target: x86_64-apple-darwin20.4.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
$ java -version
openjdk version "11.0.10" 2021-01-19
OpenJDK Runtime Environment (build 11.0.10+9)
OpenJDK 64-Bit Server VM (build 11.0.10+9, mixed mode)

marco-schmidt avatar Jun 02 '21 20:06 marco-schmidt

This problem was fixed in https://github.com/CodeIntelligenceTesting/jazzer/issues/116 by updating XCode. Could you give that a try?

fmeum avatar Jun 02 '21 20:06 fmeum

Hi @marco-schmidt ! We have made a lot of changes since you opened this ticket nearly 3-years ago. I'm following up with users of Jazzer to see how/what they achieved and if there's any way we can help. Ping me if you can discuss? david[dot]merian [at] code-intelligence[dot]com

David-Merian-CI avatar Feb 26 '24 14:02 David-Merian-CI