fuzz: add initial fuzzing infrastructure
The fuzzers will be used by oss-fuzz to automatically and continuously fuzz systemd. This commit includes the build tooling necessary to build fuzz targets, and a fuzzer for the DNS packet parser.
This commit is contained in:
Executable
+36
@@ -0,0 +1,36 @@
|
||||
#!/bin/bash
|
||||
# SPDX-License-Identifier: LGPL-2.1+
|
||||
#
|
||||
# Copyright 2017 Jonathan Rudenberg
|
||||
#
|
||||
# systemd is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU Lesser General Public License as published by
|
||||
# the Free Software Foundation; either version 2.1 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# systemd is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
set -ex
|
||||
|
||||
export LC_CTYPE=C.UTF-8
|
||||
|
||||
meson $WORK -Doss-fuzz=true -Db_lundef=false -Dseccomp=false -Dlz4=false -Dlibiptc=false -Dlibidn=false
|
||||
ninja -C $WORK fuzzers
|
||||
|
||||
# get DNS packet corpus
|
||||
df=$WORK/dns-fuzzing
|
||||
rm -rf $df
|
||||
git clone --depth 1 https://github.com/CZ-NIC/dns-fuzzing $df
|
||||
zip -jqr $OUT/fuzz-dns-packet_seed_corpus.zip $df/packet
|
||||
|
||||
mkdir -p $OUT/src/shared
|
||||
mv $WORK/src/shared/libsystemd-shared-*.so $OUT/src/shared
|
||||
|
||||
find $WORK -maxdepth 1 -type f -executable -name "fuzz-*" -exec mv {} $OUT \;
|
||||
mv $WORK/*.so src/fuzz/*.options $OUT
|
||||
Reference in New Issue
Block a user