[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xen staging] Revert "Add libfuzzer target to fuzz/x86_instruction_emulator"



commit ff652ed5dcd797a46c84258255dfd429ae68a2d6
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Mon Jul 22 11:17:17 2024 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Mon Jul 22 11:17:17 2024 +0200

    Revert "Add libfuzzer target to fuzz/x86_instruction_emulator"
    
    This reverts commit af67ae49ce8f7298bf52345558490013a9d044b3 for
    breaking the build with at least older gcc.
---
 tools/fuzz/x86_instruction_emulator/Makefile    | 11 ++---------
 tools/fuzz/x86_instruction_emulator/fuzz-emul.c |  6 ++++--
 tools/tests/x86_emulator/wrappers.c             | 11 -----------
 3 files changed, 6 insertions(+), 22 deletions(-)

diff --git a/tools/fuzz/x86_instruction_emulator/Makefile 
b/tools/fuzz/x86_instruction_emulator/Makefile
index 8606c62c83..1e4c6b37f5 100644
--- a/tools/fuzz/x86_instruction_emulator/Makefile
+++ b/tools/fuzz/x86_instruction_emulator/Makefile
@@ -3,7 +3,7 @@ include $(XEN_ROOT)/tools/Rules.mk
 
 .PHONY: x86-insn-fuzz-all
 ifeq ($(CONFIG_X86_64),y)
-x86-insn-fuzz-all: x86-insn-fuzzer.a fuzz-emul.o afl libfuzzer
+x86-insn-fuzz-all: x86-insn-fuzzer.a fuzz-emul.o afl
 else
 x86-insn-fuzz-all:
 endif
@@ -58,9 +58,6 @@ afl-harness: afl-harness.o $(OBJS) cpuid.o wrappers.o
 afl-harness-cov: afl-harness-cov.o $(patsubst %.o,%-cov.o,$(OBJS)) cpuid.o 
wrappers.o
        $(CC) $(CFLAGS) $(GCOV_FLAGS) $(addprefix 
-Wl$(comma)--wrap=,$(WRAPPED)) $^ -o $@
 
-libfuzzer-harness: $(OBJS) cpuid.o wrappers.o
-       $(CC) $(CFLAGS) $(LIB_FUZZING_ENGINE) -fsanitize=fuzzer $(addprefix 
-Wl$(comma)--wrap=,$(WRAPPED)) $^ -o $@
-
 # Common targets
 .PHONY: all
 all: x86-insn-fuzz-all
@@ -70,8 +67,7 @@ distclean: clean
 
 .PHONY: clean
 clean:
-       rm -f *.a *.o $(DEPS_RM) *.gcda *.gcno *.gcov
-       rm -f afl-harness afl-harness-cov libfuzzer-harness
+       rm -f *.a *.o $(DEPS_RM) afl-harness afl-harness-cov *.gcda *.gcno 
*.gcov
        rm -rf x86_emulate x86-emulate.c x86-emulate.h wrappers.c cpuid.c
 
 .PHONY: install
@@ -85,7 +81,4 @@ afl: afl-harness
 .PHONY: afl-cov
 afl-cov: afl-harness-cov
 
-.PHONY: libfuzzer
-libfuzzer: libfuzzer-harness
-
 -include $(DEPS_INCLUDE)
diff --git a/tools/fuzz/x86_instruction_emulator/fuzz-emul.c 
b/tools/fuzz/x86_instruction_emulator/fuzz-emul.c
index 2ba9ca9e0b..eeeb6931f4 100644
--- a/tools/fuzz/x86_instruction_emulator/fuzz-emul.c
+++ b/tools/fuzz/x86_instruction_emulator/fuzz-emul.c
@@ -906,12 +906,14 @@ int LLVMFuzzerTestOneInput(const uint8_t *data_p, size_t 
size)
 
     if ( size <= DATA_OFFSET )
     {
-        return -1;
+        printf("Input too small\n");
+        return 1;
     }
 
     if ( size > FUZZ_CORPUS_SIZE )
     {
-        return -1;
+        printf("Input too large\n");
+        return 1;
     }
 
     memcpy(&input, data_p, size);
diff --git a/tools/tests/x86_emulator/wrappers.c 
b/tools/tests/x86_emulator/wrappers.c
index 8f3bd1656f..3829a6f416 100644
--- a/tools/tests/x86_emulator/wrappers.c
+++ b/tools/tests/x86_emulator/wrappers.c
@@ -91,17 +91,6 @@ int __wrap_snprintf(char *buf, size_t n, const char *fmt, 
...)
     return rc;
 }
 
-int __wrap_vsnprintf(char *buf, size_t n, const char *fmt, va_list varg)
-{
-    int rc;
-
-    emul_save_fpu_state();
-    rc = __real_vsnprintf(buf, n, fmt, varg);
-    emul_restore_fpu_state();
-
-    return rc;
-}
-
 char *__wrap_strstr(const char *s1, const char *s2)
 {
     char *s;
--
generated by git-patchbot for /home/xen/git/xen.git#staging



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.