summaryrefslogtreecommitdiffstats
path: root/fuzz
diff options
context:
space:
mode:
authorAndrei Pavel <andrei@isc.org>2024-10-24 11:07:39 +0200
committerRazvan Becheriu <razvan@isc.org>2024-10-24 18:48:18 +0200
commitf2f5b0eec40f108a20aa1224da5b5cda601b5c10 (patch)
tree645c8b39310c767e492b5cdd982d51e2fe47349b /fuzz
parent[#3605] Add missing headers used for fuzzing (diff)
downloadkea-f2f5b0eec40f108a20aa1224da5b5cda601b5c10.tar.xz
kea-f2f5b0eec40f108a20aa1224da5b5cda601b5c10.zip
[#3605] Remove unused files in fuzz
Diffstat (limited to 'fuzz')
-rw-r--r--fuzz/dict.dat1
-rwxr-xr-xfuzz/input/regenerate-cpp-sources.sh26
-rw-r--r--fuzz/kea-dhcp4.h24
-rw-r--r--fuzz/kea-dhcp6.h31
-rwxr-xr-xfuzz/libfuzzer.sh11
-rwxr-xr-xfuzz/setup.sh112
6 files changed, 0 insertions, 205 deletions
diff --git a/fuzz/dict.dat b/fuzz/dict.dat
deleted file mode 100644
index d235ea808b..0000000000
--- a/fuzz/dict.dat
+++ /dev/null
@@ -1 +0,0 @@
-PD_POOLS="pd-pools"
diff --git a/fuzz/input/regenerate-cpp-sources.sh b/fuzz/input/regenerate-cpp-sources.sh
deleted file mode 100755
index 56af74827e..0000000000
--- a/fuzz/input/regenerate-cpp-sources.sh
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/bin/sh
-
-set -eu
-
-script_path=$(cd "$(dirname "${0}")" && pwd)
-
-cd "${script_path}"
-
-generate() {
- source="${1}"
- target="${2}"
-
- source_content=$(cat "${source}")
- variable_name=$(echo "${source}" | tr '[:lower:]' '[:upper:]' | sed 's/\./_/' | sed 's/-/_/')
-
- cat > "${target}" <<HERE_DOCUMENT
-#include <string>
-
-extern std::string ${variable_name} = R"(
-${source_content}
-)";
-HERE_DOCUMENT
-}
-
-generate kea-dhcp4.conf ../kea-dhcp4.h
-generate kea-dhcp6.conf ../kea-dhcp6.h
diff --git a/fuzz/kea-dhcp4.h b/fuzz/kea-dhcp4.h
deleted file mode 100644
index 7aa8f3e2c7..0000000000
--- a/fuzz/kea-dhcp4.h
+++ /dev/null
@@ -1,24 +0,0 @@
-#include <string>
-
-extern std::string KEA_DHCP4_CONF = R"(
-{
- "Dhcp4": {
- "interfaces-config": {
- "interfaces": [
- "*"
- ]
- },
- "subnet4": [
- {
- "id": 1,
- "pools": [
- {
- "pool": "127.0.0.0/8"
- }
- ],
- "subnet": "127.0.0.0/8"
- }
- ]
- }
-}
-)";
diff --git a/fuzz/kea-dhcp6.h b/fuzz/kea-dhcp6.h
deleted file mode 100644
index 9ccff020e4..0000000000
--- a/fuzz/kea-dhcp6.h
+++ /dev/null
@@ -1,31 +0,0 @@
-#include <string>
-
-extern std::string KEA_DHCP6_CONF = R"(
-{
- "Dhcp6": {
- "interfaces-config": {
- "interfaces": [
- "*"
- ]
- },
- "subnet6": [
- {
- "id": 1,
- "pd-pools": [
- {
- "delegated-len": 120,
- "prefix": "2001:db8:1:0:2::",
- "prefix-len": 80
- }
- ],
- "pools": [
- {
- "pool": "::/80"
- }
- ],
- "subnet": "::/64"
- }
- ]
- }
-}
-)";
diff --git a/fuzz/libfuzzer.sh b/fuzz/libfuzzer.sh
deleted file mode 100755
index fd10ef0611..0000000000
--- a/fuzz/libfuzzer.sh
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/bin/sh
-
-# Copyright (C) 2022-2024 Internet Systems Consortium, Inc. ("ISC")
-#
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-set -eux
-
-exec "${2}" "${1}/$(basename "${2}").in" -max_total_time=5 -print_pcs=1 -print_final_stats=1 -print_corpus_stats=1 -print_coverage=1
diff --git a/fuzz/setup.sh b/fuzz/setup.sh
deleted file mode 100755
index 17ea9fa54e..0000000000
--- a/fuzz/setup.sh
+++ /dev/null
@@ -1,112 +0,0 @@
-#!/bin/sh
-
-# Copyright (C) 2024 Internet Systems Consortium, Inc. ("ISC")
-#
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-# shellcheck disable=all
-
-# Disable this script altogether for now.
-exit 0
-
-# Disable this script if the interface and address are used from environment variables.
-if test -n "${KEA_DHCP4_FUZZING_INTERFACE+x}" ||
- test -n "${KEA_DHCP4_FUZZING_ADDRESS+x}" ||
- test -n "${KEA_DHCP6_FUZZING_INTERFACE+x}" ||
- test -n "${KEA_DHCP6_FUZZING_ADDRESS+x}"; then
- printf 'Environment variables set. Will use those. Abandoning.\n'
- exit 0
-fi
-
-script_path=$(cd "$(dirname "${0}")" && pwd)
-
-cd "${script_path}" > /dev/null
-
-# Add sudo to the fuzzers.
-sudo='if ! sudo -n true; then exec sudo -- "${0}" "${@}"; fi'
-for i in fuzz-*-kea-dhcp[46]; do
- continue # Disable this loop for now.
- if ! grep -F "${sudo}" "${i}" > /dev/null; then
- sed -i "2i${sudo}" "${i}"
- fi
-done
-
-# Create kea-dhcp{v}-fuzz-* wrapper scripts which adds the afl-fuzz command prefix to kea-dhcp{v}.
-for v in 4 6; do
- continue # Disable this loop for now.
- executable="../src/bin/dhcp${v}/kea-dhcp${v}"
-
- for f in config packets unix-socket; do
- fuzzed_executable="${executable}-fuzz-${f}"
- cp "${executable}" "${fuzzed_executable}"
- mkdir -p "output/config/kea-dhcp${v}"
- sed -i "s# *exec \"\$progdir/\$program\"#\n\
- export AFL_DEBUG='1'\n\
- export AFL_DEBUG_CHILD='1'\n\
- export AFL_LLVM_MAP_ADDR='true'\n\
- export AFL_MAP_SIZE='10000000'\n\
- export KEA_AFL_ADDRESS='10.1.0.1'\n\
- export KEA_AFL_INTERFACE='vethclient'\n\
- export KEA_AFL_LOOP_MAX=2\n\
- exec afl-fuzz -M fuzzer1 -t 20000+ -m 50000 -i 'seeds/${f}' -o 'output/config/kea-dhcp${v}' -x /opt/dict.dat -- \"\$progdir/\$program\"\
- #g" "${fuzzed_executable}"
- sed -i "2i${sudo}" "${fuzzed_executable}"
- done
-done
-
-cd - > /dev/null
-
-# Run again as root.
-if ! sudo -n true; then
- exec sudo -- "${0}" "${@}"
-fi
-
-# afl-fuzz says:
-# To avoid having crashes misinterpreted as timeouts, please log in as root
-# and temporarily modify /proc/sys/kernel/core_pattern, like so:
-echo core > /proc/sys/kernel/core_pattern
-
-# afl-fuzz says:
-# Whoops, your system uses on-demand CPU frequency scaling, adjusted
-# between 781 and 4882 MHz. Unfortunately, the scaling algorithm in the
-# kernel is imperfect and can miss the short-lived processes spawned by
-# afl-fuzz. To keep things moving, run these commands as root:
-echo performance | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor > /dev/null
-
-ulimit -Sd 41932800
-
-ulimit -c unlimited
-
-# Create a virtual interface for the server to start listening on.
-if ip link show vethclient > /dev/null 2>&1; then
- ip link delete vethclient
-fi
-if ip link show vethserver > /dev/null 2>&1; then
- ip link delete vethserver
-fi
-ip link add vethclient type veth peer name vethserver
-ip -4 addr add 10.1.0.1/24 dev vethclient
-ip -6 addr add 2001:db8:1::1/64 dev vethclient
-ip link set dev vethclient up
-ip link set lo up
-ip -4 addr add 10.1.0.2/24 dev vethserver
-ip -6 addr add 2001:db8:1::2/64 dev vethserver
-ip link set dev vethserver up
-ip link set lo up
-
-# Wait for duplicate address detection to be finished so that the
-# interfaces are ready.
-while true; do
- interface_status=$(
- ip a s vethserver | grep -E 'inet6.*tentative'
- ip a s vethclient | grep -E 'inet6.*tentative'
- )
- if test -n "${interface_status}"; then
- printf 'Waiting for the following addresses to be assigned to their interfaces:\n%s\n' "${interface_status}"
- sleep 1
- else
- break
- fi
-done