FUZZING.md,{libsepol,checkpolicy,libselinux}/Makefile: fix fuzzer builds
Stephen Smalley
maintainerPATCH v2 1/1 FUZZING.md,{libsepol,checkpolicy,libselinux}/Makefile: fix fuzzer builds
When building the standalone versions of the fuzzers we always want to build with CFLAGS+=-g for debugging, and we also want to clean those directories on a make clean. We also don't need to do a full make clean all since the fuzz targets depend on all when necessary and only certain subdirectories have fuzz targets. Declare the fuzz targets as .PHONY so that they always build despite the fact that there is already a directory named fuzz.
---
v2 adds .PHONY declarations to ensure that the fuzz build always run, and drops the all prerequisite for the fuzz target in checkpolicy/Makefile to avoid unnecessarily trying to build checkpolicy and checkmodule against the system headers which may fail.
FUZZING.md | 7 +++---- checkpolicy/Makefile | 4 +++- libselinux/Makefile | 9 ++++++++- libsepol/Makefile | 2 ++ 4 files changed, 16 insertions(+), 6 deletions(-)
FUZZING.md +3 -4
@@ -66,10 +66,9 @@ The fuzzers are built without debugging information and with verbose logging disabled when built using oss-fuzz.sh. You can recompile them with debugging, logging, and a trivial main() function as follows: - make clean all - make -C libsepol fuzz - make -C checkpolicy fuzz - make -C libselinux fuzz + make CFLAGS+=-g -C libsepol clean fuzz + make CFLAGS+=-g -C checkpolicy clean fuzz + make CFLAGS+=-g -C libselinux clean fuzz These build into the fuzz/ directories and do not touch any object files or archives used by the normal build.
checkpolicy/Makefile +3 -1
@@ -58,7 +58,8 @@ test: checkpolicy checkmodule # helper target for fuzzing checkobjects: $(CHECKOBJS) -fuzz: all +.PHONY: fuzz +fuzz: $(MAKE) -C fuzz install: all
@@ -81,3 +82,4 @@ relabel: install clean: -rm -f $(TARGETS) $(CHECKPOLOBJS) $(CHECKMODOBJS) y.tab.c y.tab.h lex.yy.c tests/testpol.conf tests/testpol.bin $(MAKE) -C test clean + $(MAKE) -C fuzz clean
libselinux/Makefile +8 -1
@@ -50,11 +50,18 @@ COMPILER := clang endif export COMPILER -all install relabel clean distclean: +all install relabel: @for subdir in $(SUBDIRS); do \ (cd $$subdir && $(MAKE) $@) || exit 1; \ done +clean distclean: + @for subdir in $(SUBDIRS); do \ + (cd $$subdir && $(MAKE) $@) || exit 1; \ + done + make -C fuzz clean + +.PHONY: fuzz fuzz: all $(MAKE) -C fuzz
libsepol/Makefile +2 -0
@@ -6,6 +6,7 @@ all: $(MAKE) -C src $(MAKE) -C utils +.PHONY: fuzz fuzz: all $(MAKE) -C fuzz
@@ -22,6 +23,7 @@ clean: $(MAKE) -C src clean $(MAKE) -C utils clean $(MAKE) -C tests clean + $(MAKE) -C fuzz clean test: $(MAKE) -C tests test
Signature · 1 line
2.55.0
Stephen Smalley
maintainerQuoted 10 lines · Stephen Smalley
When building the standalone versions of the fuzzers we always want to build with CFLAGS+=-g for debugging, and we also want to clean those directories on a make clean. We also don't need to do a full make clean all since the fuzz targets depend on all when necessary and only certain subdirectories have fuzz targets. Declare the fuzz targets as .PHONY so that they always build despite the fact that there is already a directory named fuzz.
Signed-off-by Stephen Smalley <[email protected]>
Merged.