Skip to content

Commit

Permalink
add cmake preset for fuzzing targets, document conda's compiler-rt
Browse files Browse the repository at this point in the history
  • Loading branch information
bkietz committed Nov 16, 2023
1 parent 4104f15 commit 743a271
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 8 deletions.
15 changes: 15 additions & 0 deletions cpp/CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,21 @@
],
"displayName": "Benchmarking build with with everything enabled",
"cacheVariables": {}
},
{
"name": "fuzzing",
"inherits": "base",
"displayName": "Debug build with IPC and Parquet fuzzing targets",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"CMAKE_C_COMPILER": "clang",
"CMAKE_CXX_COMPILER": "clang++",
"ARROW_USE_ASAN": "ON",
"ARROW_USE_UBSAN": "ON",
"ARROW_IPC": "ON",
"ARROW_PARQUET": "ON",
"ARROW_FUZZING": "ON"
}
}
]
}
24 changes: 16 additions & 8 deletions docs/source/developers/cpp/fuzzing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ areas ingesting potentially invalid or malicious data.
Fuzz Targets and Utilities
==========================

By passing the ``-DARROW_FUZZING=ON`` CMake option, you will build
the fuzz targets corresponding to the aforementioned Arrow features, as well
as additional related utilities.
By passing the ``-DARROW_FUZZING=ON`` CMake option (or equivalently, using
the ``fuzzing`` preset), you will build the fuzz targets corresponding to
the aforementioned Arrow features, as well as additional related utilities.

Generating the seed corpus
--------------------------
Expand Down Expand Up @@ -85,11 +85,7 @@ various sanitizer checks enabled.

.. code-block::
$ cmake .. -GNinja \
-DCMAKE_BUILD_TYPE=Debug \
-DARROW_USE_ASAN=on \
-DARROW_USE_UBSAN=on \
-DARROW_FUZZING=on
$ cmake .. --preset=fuzzing
Then, assuming you have downloaded the crashing data file (let's call it
``testcase-arrow-ipc-file-fuzz-123465``), you can reproduce the crash
Expand All @@ -101,3 +97,15 @@ by running the affected fuzz target on that file:
(you may want to run that command under a debugger so as to inspect the
program state more closely)

Using conda
-----------

The fuzzing executables must be compiled with clang and linked to libraries
which provide a fuzzing runtime. If you are using conda to provide your
dependencies, you may need to install these before building the fuzz targets:

.. code-block::
$ conda install clang clangxx compiler-rt
$ cmake .. --preset=fuzzing

0 comments on commit 743a271

Please sign in to comment.