From b25b99d704deda9c187ab20724f5788ad9441eb3 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Thu, 16 Jul 2026 09:57:10 -0400 Subject: [PATCH 1/3] make: fix some cleaned object filenames for fuzz-clean "make fuzz-clean" is trying to remove valgrind files that fuzz no longer generates, as well as log files that are no longer in the top-level directory. This removes the valgrind bits and fixes the directory. Signed-off-by: Peter Jones --- include/fuzz.mk | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/include/fuzz.mk b/include/fuzz.mk index 44b0776ef..632039604 100644 --- a/include/fuzz.mk +++ b/include/fuzz.mk @@ -113,8 +113,7 @@ fuzz : $(fuzzers) $(MAKE) -f include/fuzz.mk fuzz-clean fuzz-clean : - @rm -vf random.bin libefi-test.a - @rm -vf vgcore.* fuzz*.log + @rm -vf random.bin libefi-test.a $(wildcard *-corpus/fuzz*.log) clean : fuzz-clean From d0e35692ab1dd199325ea4452fd569c7338abe25 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Thu, 16 Jul 2026 09:58:48 -0400 Subject: [PATCH 2/3] make: clean fuzz and test stuff from the top-level makefile usually During some testing I noticed "make clean" when cross-building for Aarch64 included gcc complaining about "-mstrict-align", which is weird because aarch64-linux-gnu-gcc supports that just fine. Turns out it's because the test makefile is always using 'gcc', and that means it's calling 'gcc $(ARCH_CFLAGS) ... -print-file-name=include-fixed' to figure out compiler arguments that don't matter for the clean target. Since we don't actually have any support for using the cross-compiler to build test or fuzz targets, as we would have no way to run them, this will always happen and it'll always be dumb. This change makes it so Instead we just don't descend into those makefiles if we're just cleaning and not actually building/running the tests or fuzzers. Signed-off-by: Peter Jones --- Makefile | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 391ca1986..1973c01ef 100644 --- a/Makefile +++ b/Makefile @@ -469,24 +469,31 @@ else $(PESIGN) -n certdb -i $< -c "shim" -s -o $@ -f endif -fuzz fuzz-clean fuzz-coverage fuzz-lto : +fuzz fuzz-coverage fuzz-lto : @make -f $(TOPDIR)/include/fuzz.mk \ COMPILER="$(COMPILER)" \ CROSS_COMPILE="$(CROSS_COMPILE)" \ CLANG_WARNINGS="$(CLANG_WARNINGS)" \ ARCH_DEFINES="$(ARCH_DEFINES)" \ EFI_INCLUDES="$(EFI_INCLUDES)" \ - fuzz-clean $@ + $@ -test test-clean test-coverage test-lto : | clean-test-results -test test-clean test-coverage test-lto : generated_sbat_var_defs.h +test test-coverage test-lto : | clean-test-results +test test-coverage test-lto : generated_sbat_var_defs.h @make -f $(TOPDIR)/include/test.mk \ COMPILER="$(COMPILER)" \ CROSS_COMPILE="$(CROSS_COMPILE)" \ CLANG_WARNINGS="$(CLANG_WARNINGS)" \ ARCH_DEFINES="$(ARCH_DEFINES)" \ EFI_INCLUDES="$(EFI_INCLUDES)" \ - test-clean $@ + $@ + +fuzz-clean: + @rm -vf random.bin libefi-test.a $(wildcard *-corpus/fuzz*.log) + +test-clean: + @rm -vf test-random.h libefi-test.a + @rm -vf vgcore.* $(patsubst %.c,%,$(wildcard fuzz-*.c)) : @make -f $(TOPDIR)/include/fuzz.mk EFI_INCLUDES="$(EFI_INCLUDES)" ARCH_DEFINES="$(ARCH_DEFINES)" $@ @@ -496,10 +503,10 @@ $(patsubst %.c,%,$(wildcard test-*.c)) : @make -f $(TOPDIR)/include/test.mk EFI_INCLUDES="$(EFI_INCLUDES)" ARCH_DEFINES="$(ARCH_DEFINES)" $@ clean-fuzz-objs: - @make -f $(TOPDIR)/include/fuzz.mk EFI_INCLUDES="$(EFI_INCLUDES)" ARCH_DEFINES="$(ARCH_DEFINES)" clean + @find . -type f -a -perm /111 -a -iname 'fuzz-*' -print -delete clean-test-objs: - @make -f $(TOPDIR)/include/test.mk EFI_INCLUDES="$(EFI_INCLUDES)" ARCH_DEFINES="$(ARCH_DEFINES)" clean + @find . -type f -a -perm /111 -a -iname 'test-*' -print -delete .PHONY : $(patsubst %.c,%,$(wildcard fuzz-*.c)) fuzz .PHONY : $(patsubst %.c,%,$(wildcard test-*.c)) test From de2b4e0ae4378430ce453bc56da3df04bf3b42ee Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Thu, 16 Jul 2026 13:11:06 -0400 Subject: [PATCH 3/3] make: make 'make fuzz' targets make more sense Currently there are three top-level "make fuzz" targets aside from our individual fuzzers: "fuzz", "fuzz-lto", and "fuzz-coverage". The last two were copy pasted from "make test" rules, and they make no sense here. Additionally, the "make fuzz" rule itself makes no sense as given, since it'll try to run all the fuzzers, one at a time, each with no time limit. This patch removes the two dumb rules and adds a 60-second limit to the main rule. Signed-off-by: Peter Jones --- Make.defaults | 1 + Makefile | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Make.defaults b/Make.defaults index 1d2f188b8..f12dc36e7 100644 --- a/Make.defaults +++ b/Make.defaults @@ -43,6 +43,7 @@ export OPTIMIZATIONS ifneq ($(CCACHE_DISABLE),) export CCACHE_DISABLE endif +MAX_FUZZ_TIME ?= 60 SUBDIRS = $(TOPDIR)/Cryptlib $(TOPDIR)/lib diff --git a/Makefile b/Makefile index 1973c01ef..8a68bf36d 100644 --- a/Makefile +++ b/Makefile @@ -469,13 +469,14 @@ else $(PESIGN) -n certdb -i $< -c "shim" -s -o $@ -f endif -fuzz fuzz-coverage fuzz-lto : +fuzz: @make -f $(TOPDIR)/include/fuzz.mk \ COMPILER="$(COMPILER)" \ CROSS_COMPILE="$(CROSS_COMPILE)" \ CLANG_WARNINGS="$(CLANG_WARNINGS)" \ ARCH_DEFINES="$(ARCH_DEFINES)" \ EFI_INCLUDES="$(EFI_INCLUDES)" \ + MAX_FUZZ_TIME=$(MAX_FUZZ_TIME) \ $@ test test-coverage test-lto : | clean-test-results