Add fuzzing syscall sandbox: detect use of unexpected syscalls when fuzzing.
This PR is based on #20487. Only the last commit is new to this PR.
Example use:
0$ make distclean
1$ ./autogen.sh
2$ CC=clang CXX=clang++ ./configure --enable-fuzz --with-sanitizers=fuzzer --with-syscall-sandbox
3$ make
4$ FUZZ=example_fuzzing_harness src/test/fuzz/fuzz
5…
6ERROR: The syscall "socket" (syscall number 41) is not allowed by the syscall sandbox in thread "*unnamed*". Please report. Exiting.
7terminate called without an active exception
8==27953== ERROR: libFuzzer: deadly signal
9…
10 [#11](/bitcoin-bitcoin/11/) 0x7f11a5dd0b20 in std::terminate() (/usr/lib/x86_64-linux-gnu/libstdc++.so.6+0x92b20)
11 [#12](/bitcoin-bitcoin/12/) 0x56445a4b8cb7 in (anonymous namespace)::SyscallSandboxDebugSignalHandler(int, siginfo_t*, void*) src/util/syscall_sandbox.cpp:71:5
12…
13artifact_prefix='./'; Test unit written to ./crash-78657a4e3dda0e9557c5a4f56dd9d19763459865
In this example use of an unexpected networking syscall (socket
) was detected when running the example harness example_fuzzing_harness
.