[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240715144529.101634-2-masahiroy@kernel.org>
Date: Mon, 15 Jul 2024 23:45:23 +0900
From: Masahiro Yamada <masahiroy@...nel.org>
To: Kees Cook <kees@...nel.org>,
	linux-hardening@...r.kernel.org
Cc: linux-kbuild@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	Masahiro Yamada <masahiroy@...nel.org>
Subject: [PATCH 1/3] fortify: use if_changed_dep to record header dependency in *.cmd files
After building with CONFIG_FORTIFY_SOURCE=y, many .*.d files are left
in lib/test_fortify/ because the compiler outputs header dependencies
into *.d without fixdep being invoked.
When compiling C files, if_changed_dep should be used so that the
auto-generated header dependencies are recorded in .*.cmd files.
Currently, if_changed is incorrectly used, and only two headers are
hard-coded in lib/Makefile.
Signed-off-by: Masahiro Yamada <masahiroy@...nel.org>
---
 lib/Makefile | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/lib/Makefile b/lib/Makefile
index 30337431d10e..429b259b5b64 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -408,11 +408,9 @@ targets += $(TEST_FORTIFY_LOGS)
 clean-files += $(TEST_FORTIFY_LOGS)
 clean-files += $(addsuffix .o, $(TEST_FORTIFY_LOGS))
 $(obj)/test_fortify/%.log: $(src)/test_fortify/%.c \
-			   $(src)/test_fortify/test_fortify.h \
-			   $(srctree)/include/linux/fortify-string.h \
 			   $(srctree)/scripts/test_fortify.sh \
 			   FORCE
-	$(call if_changed,test_fortify)
+	$(call if_changed_dep,test_fortify)
 
 quiet_cmd_gen_fortify_log = GEN     $@
       cmd_gen_fortify_log = cat </dev/null $(filter-out FORCE,$^) 2>/dev/null > $@ || true
-- 
2.43.0
Powered by blists - more mailing lists