[PATCH] oss-fuzz: Fix coverage runtime error

Tamas K Lengyel posted 1 patch 2 months, 3 weeks ago
Patches applied successfully (tree, apply log)
git fetch https://gitlab.com/xen-project/patchew/xen tags/patchew/20240828133823.1114-1-tamas@tklengyel.com
tools/fuzz/oss-fuzz/build.sh | 4 ++++
1 file changed, 4 insertions(+)
[PATCH] oss-fuzz: Fix coverage runtime error
Posted by Tamas K Lengyel 2 months, 3 weeks ago
The oss-fuzz infrastructure collects runtime coverage information for debugging
and fuzzing evaluation. Currently it appears broken due to missing C files.
This is because the fuzzer's Makefile only symlinks the C files from various
locations in the Xen source tree into the build folder. These symlinks however
are gone as oss-fuzz uses separate docker containers for the build and for the
run.

Update the oss-fuzz build script to copy the required C files into the
build folder to fix this oss-fuzz specific issue.

Signed-off-by: Tamas K Lengyel <tamas@tklengyel.com>
---
 tools/fuzz/oss-fuzz/build.sh | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/tools/fuzz/oss-fuzz/build.sh b/tools/fuzz/oss-fuzz/build.sh
index 08eeb66e4c..002d86c44f 100644
--- a/tools/fuzz/oss-fuzz/build.sh
+++ b/tools/fuzz/oss-fuzz/build.sh
@@ -9,3 +9,7 @@ cd xen
 make clang=y -C tools/include
 make clang=y -C tools/fuzz/x86_instruction_emulator libfuzzer-harness
 cp tools/fuzz/x86_instruction_emulator/libfuzzer-harness $OUT/x86_instruction_emulator
+
+# Runtime coverage collection requires access to source files and symlinks don't work
+cp xen/lib/x86/*.c tools/fuzz/x86_instruction_emulator
+cp tools/tests/x86_emulator/*.c tools/fuzz/x86_instruction_emulator
-- 
2.34.1
Re: [PATCH] oss-fuzz: Fix coverage runtime error
Posted by Andrew Cooper 2 months, 3 weeks ago
On 28/08/2024 2:38 pm, Tamas K Lengyel wrote:
> The oss-fuzz infrastructure collects runtime coverage information for debugging
> and fuzzing evaluation. Currently it appears broken due to missing C files.
> This is because the fuzzer's Makefile only symlinks the C files from various
> locations in the Xen source tree into the build folder. These symlinks however
> are gone as oss-fuzz uses separate docker containers for the build and for the
> run.
>
> Update the oss-fuzz build script to copy the required C files into the
> build folder to fix this oss-fuzz specific issue.
>
> Signed-off-by: Tamas K Lengyel <tamas@tklengyel.com>

Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>

Thanks for looking into this.