Skip to content

Use libFuzzer with intel/llvm? #8027

@BenBrock

Description

@BenBrock

Is it possible to use libFuzzer with intel/llvm? Neither libFuzzer nor fuzztest (which depends on libFuzzer) are currently working for me. Perhaps they are not being included in my open-source build of intel/llvm, and I could enable them?

I'd like to be able to use libFuzzer and fuzztest, as they are the most reasonable fuzzers for fuzzing C++ AFAIK. (Fuzzing is now an SDL security requirement for any Intel project that wants to open-source.)

I get the following linker error with libFuzz:

bbrock@ortce-skl22:~/src/libfuzzer$ !cl
clang++ -g -O1 -fsanitize=fuzzer target01.cpp
/usr/bin/ld: cannot find /nfs/site/home/bbrock/pkg/dpcpp-new/lib/clang/16/lib/linux/libclang_rt.fuzzer-x86_64.a: No such file or directory
/usr/bin/ld: cannot find /nfs/site/home/bbrock/pkg/dpcpp-new/lib/clang/16/lib/linux/libclang_rt.fuzzer_interceptors-x86_64.a: No such file or directory
/usr/bin/ld: cannot find /nfs/site/home/bbrock/pkg/dpcpp-new/lib/clang/16/lib/linux/libclang_rt.ubsan_standalone-x86_64.a: No such file or directory
/usr/bin/ld: cannot find /nfs/site/home/bbrock/pkg/dpcpp-new/lib/clang/16/lib/linux/libclang_rt.ubsan_standalone_cxx-x86_64.a: No such file or directory
clang-16: error: linker command failed with exit code 1 (use -v to see invocation)

And the following error with fuzztest:

bbrock@ortce-skl22:~/src/fuzztest_fuzzing/tests$ bazelisk run --config=fuzztest :fuzz_01 -- --fuzz=MyTestSuite.IntegerAdditionCommutes
WARNING: Output base '/nfs/site/home/bbrock/.cache/bazel/_bazel_bbrock/251aee0dce075fee5e98058522271f88' is on NFS. This may lead to surprising failures and undetermined behavior.
INFO: Analyzed target //tests:fuzz_01 (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
ERROR: /nfs/site/home/bbrock/.cache/bazel/_bazel_bbrock/251aee0dce075fee5e98058522271f88/external/com_google_absl/absl/strings/BUILD.bazel:456:11: Compiling absl/strings/internal/cordz_handle.cc failed: (Exit 1): clang-16 failed: error executing command (from target @com_google_absl//absl/strings:cordz_handle) /nfs/site/home/bbrock/pkg/dpcpp-new/bin/clang-16 -U_FORTIFY_SOURCE -fstack-protector -Wall -Wthread-safety -Wself-assign -Wunused-but-set-parameter -Wno-free-nonheap-object -fcolor-diagnostics ... (remaining 64 arguments skipped)

Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
In file included from external/com_google_absl/absl/strings/internal/cordz_handle.cc:14:
In file included from external/com_google_absl/absl/strings/internal/cordz_handle.h:23:
In file included from external/com_google_absl/absl/base/internal/spinlock.h:37:
In file included from external/com_google_absl/absl/base/dynamic_annotations.h:57:
external/com_google_absl/absl/base/internal/dynamic_annotations.h:369:10: fatal error: 'sanitizer/common_interface_defs.h' file not found
#include <sanitizer/common_interface_defs.h>
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
Target //tests:fuzz_01 failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 3.120s, Critical Path: 2.69s
INFO: 95 processes: 83 internal, 12 processwrapper-sandbox.
FAILED: Build did NOT complete successfully
ERROR: Build failed. Not running target

I am currently using a vanilla build of intel/llvm, compiled from commit 2df2cc3.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions