fortify: fix various issues in test_fortify Makefile
Subsystems (3)
cover fortify: fix various issues in test_fortify Makefile
Applicable to v6.10 tag.
Masahiro Yamada (3):
fortify: use if_changed_dep to record header dependency in *.cmd files
fortify: refactor test_fortify Makefile to fix some build problems
fortify: move test_fortify.sh to lib/test_fortify/
MAINTAINERS | 1 -
lib/.gitignore | 2 -
lib/Makefile | 38 +------------------
lib/test_fortify/.gitignore | 2 +
lib/test_fortify/Makefile | 25 ++++++++++++
{scripts => lib/test_fortify}/test_fortify.sh | 0
6 files changed, 28 insertions(+), 40 deletions(-)
create mode 100644 lib/test_fortify/.gitignore
create mode 100644 lib/test_fortify/Makefile
rename {scripts => lib/test_fortify}/test_fortify.sh (100%)Signature · 1 line
2.43.0
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.
---
lib/Makefile | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
lib/Makefile +1 -3
@@ -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
Signature · 1 line
2.43.0
PATCH 2/3 fortify: refactor test_fortify Makefile to fix some build problems
In reply to Masahiro YamadaThere are some issues in the test_fortify Makefile code.
Problem 1: cc-disable-warning invokes compiler dozens of times
To see how many times the cc-disable-warning is evaluated, change this code:
$(call cc-disable-warning,fortify-source)
to:
$(call cc-disable-warning,$(shell touch /tmp/fortify-$$$$)fortify-source)
Then, build the kernel with CONFIG_FORTIFY_SOURCE=y. You will see a large number of '/tmp/fortify-<PID>' files created:
$ ls -1 /tmp/fortify-* | wc
80 80 1600This means the compiler was invoked 80 times just for checking the -Wno-fortify-source flag support.
$(call cc-disable-warning,fortify-source) should be added to a simple variable instead of a recursive variable.
Problem 2: do not recompile string.o when the test code is updated
The test cases are independent of the kernel. However, when the test code is updated, $(obj)/string.o is rebuilt and vmlinux is relinked due to this dependency:
$(obj)/string.o: $(obj)/$(TEST_FORTIFY_LOG)
always-y is suitable for building the log files.
Problem 3: redundant code
clean-files += $(addsuffix .o, $(TEST_FORTIFY_LOGS))
... is unneeded because the top Makefile globally cleans *.o files.
This commit fixes these issues and makes the code readable.
---
lib/.gitignore | 2 -- lib/Makefile | 36 +----------------------------------- lib/test_fortify/.gitignore | 2 ++ lib/test_fortify/Makefile | 25 +++++++++++++++++++++++++ 4 files changed, 28 insertions(+), 37 deletions(-) create mode 100644 lib/test_fortify/.gitignore create mode 100644 lib/test_fortify/Makefile
lib/.gitignore +0 -2
@@ -5,5 +5,3 @@ /gen_crc32table /gen_crc64table /oid_registry_data.c -/test_fortify.log -/test_fortify/*.log
lib/Makefile +1 -35
@@ -393,38 +393,4 @@ obj-$(CONFIG_GENERIC_LIB_DEVMEM_IS_ALLOWED) += devmem_is_allowed.o obj-$(CONFIG_FIRMWARE_TABLE) += fw_table.o -# FORTIFY_SOURCE compile-time behavior tests -TEST_FORTIFY_SRCS = $(wildcard $(src)/test_fortify/*-*.c) -TEST_FORTIFY_LOGS = $(patsubst $(src)/%.c, %.log, $(TEST_FORTIFY_SRCS)) -TEST_FORTIFY_LOG = test_fortify.log - -quiet_cmd_test_fortify = TEST $@ - cmd_test_fortify = $(CONFIG_SHELL) $(srctree)/scripts/test_fortify.sh \ - $< $@ "$(NM)" $(CC) $(c_flags) \ - $(call cc-disable-warning,fortify-source) \ - -DKBUILD_EXTRA_WARN1 - -targets += $(TEST_FORTIFY_LOGS) -clean-files += $(TEST_FORTIFY_LOGS) -clean-files += $(addsuffix .o, $(TEST_FORTIFY_LOGS)) -$(obj)/test_fortify/%.log: $(src)/test_fortify/%.c \ - $(srctree)/scripts/test_fortify.sh \ - FORCE - $(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 - -targets += $(TEST_FORTIFY_LOG) -clean-files += $(TEST_FORTIFY_LOG) -$(obj)/$(TEST_FORTIFY_LOG): $(addprefix $(obj)/, $(TEST_FORTIFY_LOGS)) FORCE - $(call if_changed,gen_fortify_log) - -# Fake dependency to trigger the fortify tests. -ifeq ($(CONFIG_FORTIFY_SOURCE),y) -$(obj)/string.o: $(obj)/$(TEST_FORTIFY_LOG) -endif - -# Some architectures define __NO_FORTIFY if __SANITIZE_ADDRESS__ is undefined. -# Pass CFLAGS_KASAN to avoid warnings. -$(foreach x, $(patsubst %.log,%.o,$(TEST_FORTIFY_LOGS)), $(eval KASAN_SANITIZE_$(x) := y)) +subdir-$(CONFIG_FORTIFY_SOURCE) += test_fortify
lib/test_fortify/.gitignore new file +2 -0
@@ -0,0 +1,2 @@ +# SPDX-License-Identifier: GPL-2.0-only +/*.log
lib/test_fortify/Makefile new file +25 -0
@@ -0,0 +1,25 @@ +# SPDX-License-Identifier: GPL-2.0 + +ccflags-y := $(call cc-disable-warning,fortify-source) + +quiet_cmd_test_fortify = TEST $@ + cmd_test_fortify = $(CONFIG_SHELL) $(srctree)/scripts/test_fortify.sh \ + $< $@ "$(NM)" $(CC) $(c_flags) -DKBUILD_EXTRA_WARN1 + +$(obj)/%.log: $(src)/%.c $(srctree)/scripts/test_fortify.sh FORCE + $(call if_changed_dep,test_fortify) + +logs = $(patsubst $(src)/%.c, %.log, $(wildcard $(src)/*-*.c)) +targets += $(logs) + +quiet_cmd_gen_fortify_log = CAT $@ + cmd_gen_fortify_log = cat $(or $(real-prereqs),/dev/null) > $@ + +$(obj)/test_fortify.log: $(addprefix $(obj)/, $(logs)) FORCE + $(call if_changed,gen_fortify_log) + +always-y += test_fortify.log + +# Some architectures define __NO_FORTIFY if __SANITIZE_ADDRESS__ is undefined. +# Pass CFLAGS_KASAN to avoid warnings. +KASAN_SANITIZE := y
Signature · 1 line
2.43.0
PATCH 3/3 fortify: move test_fortify.sh to lib/test_fortify/
In reply to Masahiro YamadaThis script is only used in lib/test_fortify/.
There is no reason to keep it in scripts/.
---
MAINTAINERS | 1 -
lib/test_fortify/Makefile | 4 ++--
{scripts => lib/test_fortify}/test_fortify.sh | 0
3 files changed, 2 insertions(+), 3 deletions(-)
rename {scripts => lib/test_fortify}/test_fortify.sh (100%)MAINTAINERS +0 -1
@@ -8598,7 +8598,6 @@ F: include/linux/fortify-string.h F: lib/fortify_kunit.c F: lib/memcpy_kunit.c F: lib/test_fortify/* -F: scripts/test_fortify.sh K: \b__NO_FORTIFY\b FPGA DFL DRIVERS
lib/test_fortify/Makefile +2 -2
@@ -3,10 +3,10 @@ ccflags-y := $(call cc-disable-warning,fortify-source) quiet_cmd_test_fortify = TEST $@ - cmd_test_fortify = $(CONFIG_SHELL) $(srctree)/scripts/test_fortify.sh \ + cmd_test_fortify = $(CONFIG_SHELL) $(src)/test_fortify.sh \ $< $@ "$(NM)" $(CC) $(c_flags) -DKBUILD_EXTRA_WARN1 -$(obj)/%.log: $(src)/%.c $(srctree)/scripts/test_fortify.sh FORCE +$(obj)/%.log: $(src)/%.c $(src)/test_fortify.sh FORCE $(call if_changed_dep,test_fortify) logs = $(patsubst $(src)/%.c, %.log, $(wildcard $(src)/*-*.c))
lib/test_fortify/test_fortify.sh renamed from scripts/test_fortify.sh +0 -0
Signature · 1 line
2.43.0
Kees Cook
maintainerQuoted 8 lines · Masahiro Yamada
Applicable to v6.10 tag.
Masahiro Yamada (3):
fortify: useif_changed_depto record header dependency in *.cmd files
fortify: refactortest_fortifyMakefileto fix some build problems
fortify: movetest_fortify.shtolib/test_fortify/
Thanks for this improvement! I will take this into the hardening tree after -rc2, unless you would prefer to send this during the merge window based on your tree? (The fix you sent for the v6.10 release means my trees based on -rc2 can't apply this series...)
-Kees
Signature · 1 line
Kees Cook
Quoted 11 lines · Kees Cook
Quoted 8 lines · Masahiro Yamada
Applicable to v6.10 tag.
Masahiro Yamada (3):
fortify: useif_changed_depto record header dependency in *.cmd files
fortify: refactortest_fortifyMakefileto fix some build problems
fortify: movetest_fortify.shtolib/test_fortify/
Quoted 4 lines
Thanks for this improvement! I will take this into the hardening tree after -rc2, unless you would prefer to send this during the merge window based on your tree? (The fix you sent for the v6.10 release means my trees based on -rc2 can't apply this series...)
No problem.
This patch set is not urgent.
Quoted 6 lines
-Kees
--
Kees Cook
--
Best Regards
Masahiro Yamada
kernel test robot
build botRe: [PATCH 1/3] fortify: use if_changed_dep to record header dependency in *.cmd files
In reply to Masahiro Yamadakernel test robot noticed the following build errors:
Hi Masahiro,
kernel test robot noticed the following build errors:
[auto build test ERROR on linus/master]
[also build test ERROR on v6.10 next-20240716]
[cannot apply to akpm-mm/mm-nonmm-unstable kees/for-next/hardening kees/for-next/pstore kees/for-next/kspp] [If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Masahiro-Yamada/fortify-use-if_changed_dep-to-record-header-dependency-in-cmd-files/20240715-224820 base: linus/master patch link: https://lore.kernel.org/r/20240715144529.101634-2-masahiroy%40kernel.org patch subject: [PATCH 1/3] fortify: use if_changed_dep to record header dependency in *.cmd files config: i386-randconfig-004-20240716 (https://download.01.org/0day-ci/archive/20240717/[email protected]/config) compiler: gcc-7 (Ubuntu 7.5.0-6ubuntu2) 7.5.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240717/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All errors (new ones prefixed by >>):
>> fixdep: error opening file: lib/test_fortify/.write_overflow-memcpy.log.d: No such file or directory -- >> fixdep: error opening file: lib/test_fortify/.read_overflow2-memcmp.log.d: No such file or directory -- >> fixdep: error opening file: lib/test_fortify/.read_overflow-memchr.log.d: No such file or directory -- >> fixdep: error opening file: lib/test_fortify/.write_overflow-strcpy-lit.log.d: No such file or directory -- >> fixdep: error opening file: lib/test_fortify/.read_overflow2-memmove.log.d: No such file or directory -- >> fixdep: error opening file: lib/test_fortify/.write_overflow-strncpy-src.log.d: No such file or directory -- >> fixdep: error opening file: lib/test_fortify/.read_overflow-memcmp.log.d: No such file or directory -- >> fixdep: error opening file: lib/test_fortify/.read_overflow-memscan.log.d: No such file or directory -- >> fixdep: error opening file: lib/test_fortify/.write_overflow-strcpy.log.d: No such file or directory -- >> fixdep: error opening file: lib/test_fortify/.write_overflow-memmove.log.d: No such file or directory -- >> fixdep: error opening file: lib/test_fortify/.write_overflow-memset.log.d: No such file or directory
..
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
Re: [PATCH 1/3] fortify: use if_changed_dep to record header dependency in *.cmd files
Quoted 41 lines · kernel test robot
Hi Masahiro,
kernel test robot noticed the following build errors:
[auto build test ERROR on linus/master]
[also build test ERROR on v6.10 next-20240716]
[cannot apply to akpm-mm/mm-nonmm-unstable kees/for-next/hardening kees/for-next/pstore kees/for-next/kspp] [If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]url: https://github.com/intel-lab-lkp/linux/commits/Masahiro-Yamada/fortify-use-if_changed_dep-to-record-header-dependency-in-cmd-files/20240715-224820 base: linus/master patch link: https://lore.kernel.org/r/20240715144529.101634-2-masahiroy%40kernel.org patch subject: [PATCH 1/3] fortify: use if_changed_dep to record header dependency in *.cmd files config: i386-randconfig-004-20240716 (https://download.01.org/0day-ci/archive/20240717/[email protected]/config) compiler: gcc-7 (Ubuntu 7.5.0-6ubuntu2) 7.5.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240717/[email protected]/reproduce)If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/All errors (new ones prefixed by >>):
Quoted 1 line
Quoted 1 line
fixdep: error opening file:
lib/test_fortify/.write_overflow-memcpy.log.d: No such file or directory--
Quoted 1 line
Quoted 1 line
fixdep: error opening file:
lib/test_fortify/.read_overflow2-memcmp.log.d: No such file or directory--
Quoted 1 line
Quoted 1 line
fixdep: error opening file:
lib/test_fortify/.read_overflow-memchr.log.d: No such file or directory--
Quoted 1 line
Quoted 1 line
fixdep: error opening file:
lib/test_fortify/.write_overflow-strcpy-lit.log.d: No such file or directory--
Quoted 1 line
Quoted 1 line
fixdep: error opening file:
lib/test_fortify/.read_overflow2-memmove.log.d: No such file or directory--
Quoted 1 line
Quoted 1 line
fixdep: error opening file:
lib/test_fortify/.write_overflow-strncpy-src.log.d: No such file or directory--
Quoted 1 line
Quoted 1 line
fixdep: error opening file:
lib/test_fortify/.read_overflow-memcmp.log.d: No such file or directory--
Quoted 8 lines
Quoted 1 line
Quoted 1 line
fixdep: error opening file:
lib/test_fortify/.read_overflow-memscan.log.d: No such file or directory--
Quoted 1 line
Quoted 1 line
fixdep: error opening file:
lib/test_fortify/.write_overflow-strcpy.log.d: No such file or directory--
Quoted 1 line
Quoted 1 line
fixdep: error opening file:
lib/test_fortify/.write_overflow-memmove.log.d: No such file or directory--
Quoted 1 line
Quoted 1 line
fixdep: error opening file:
lib/test_fortify/.write_overflow-memset.log.d: No such file or directory..
This issue seems to occur with GCC <=7
$ echo 'void b(void) __attribute__((__error__(""))); void a(void) {
b(); }' | gcc -Wp,-MMD,test.d -c -o /dev/null -x c -did not create *.d with GCC <= 7.
I do not see the issue with GCC >= 8 or Clang.
One quick solution is to skip the test for GCC <= 7.
Quoted 5 lines
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
Signature · 2 lines
Best Regards Masahiro Yamada
Kees Cook
maintainerRe: [PATCH 1/3] fortify: use if_changed_dep to record header dependency in *.cmd files
Quoted 56 lines · Masahiro Yamada
Quoted 41 lines · kernel test robot
Hi Masahiro,
kernel test robot noticed the following build errors:
[auto build test ERROR on linus/master]
[also build test ERROR on v6.10 next-20240716]
[cannot apply to akpm-mm/mm-nonmm-unstable kees/for-next/hardening kees/for-next/pstore kees/for-next/kspp] [If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]url: https://github.com/intel-lab-lkp/linux/commits/Masahiro-Yamada/fortify-use-if_changed_dep-to-record-header-dependency-in-cmd-files/20240715-224820 base: linus/master patch link: https://lore.kernel.org/r/20240715144529.101634-2-masahiroy%40kernel.org patch subject: [PATCH 1/3] fortify: use if_changed_dep to record header dependency in *.cmd files config: i386-randconfig-004-20240716 (https://download.01.org/0day-ci/archive/20240717/[email protected]/config) compiler: gcc-7 (Ubuntu 7.5.0-6ubuntu2) 7.5.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240717/[email protected]/reproduce)If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/All errors (new ones prefixed by >>):
Quoted 1 line
Quoted 1 line
fixdep: error opening file:
lib/test_fortify/.write_overflow-memcpy.log.d: No such file or directory--
Quoted 1 line
Quoted 1 line
fixdep: error opening file:
lib/test_fortify/.read_overflow2-memcmp.log.d: No such file or directory--
Quoted 1 line
Quoted 1 line
fixdep: error opening file:
lib/test_fortify/.read_overflow-memchr.log.d: No such file or directory--
Quoted 1 line
Quoted 1 line
fixdep: error opening file:
lib/test_fortify/.write_overflow-strcpy-lit.log.d: No such file or directory--
Quoted 1 line
Quoted 1 line
fixdep: error opening file:
lib/test_fortify/.read_overflow2-memmove.log.d: No such file or directory--
Quoted 1 line
Quoted 1 line
fixdep: error opening file:
lib/test_fortify/.write_overflow-strncpy-src.log.d: No such file or directory--
Quoted 1 line
Quoted 1 line
fixdep: error opening file:
lib/test_fortify/.read_overflow-memcmp.log.d: No such file or directory--
Quoted 8 lines
Quoted 1 line
Quoted 1 line
fixdep: error opening file:
lib/test_fortify/.read_overflow-memscan.log.d: No such file or directory--
Quoted 1 line
Quoted 1 line
fixdep: error opening file:
lib/test_fortify/.write_overflow-strcpy.log.d: No such file or directory--
Quoted 1 line
Quoted 1 line
fixdep: error opening file:
lib/test_fortify/.write_overflow-memmove.log.d: No such file or directory--
Quoted 1 line
Quoted 1 line
fixdep: error opening file:
lib/test_fortify/.write_overflow-memset.log.d: No such file or directory..
This issue seems to occur with GCC <=7
Quoted 7 lines
$ echo 'void b(void) __attribute__((__error__(""))); void a(void) { b(); }' | gcc -Wp,-MMD,test.d -c -o /dev/null -x c -did not create *.d with GCC <= 7.
I do not see the issue with GCC >= 8 or Clang.
Any idea why this happens here and not for other sources in the tree?
Quoted 1 line
One quick solution is to skip the test for GCC <= 7.
I'd be fine with that -- it is designed to catch regressions/misbehaviours in newly release compilers so I don't mind dropping checks against older versions.
Signature · 1 line
Kees Cook
Re: [PATCH 1/3] fortify: use if_changed_dep to record header dependency in *.cmd files
Quoted 62 lines · Kees Cook
Quoted 60 lines · Masahiro Yamada
Quoted 41 lines · kernel test robot
Hi Masahiro,
kernel test robot noticed the following build errors:
[auto build test ERROR on linus/master]
[also build test ERROR on v6.10 next-20240716]
[cannot apply to akpm-mm/mm-nonmm-unstable kees/for-next/hardening kees/for-next/pstore kees/for-next/kspp] [If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]url: https://github.com/intel-lab-lkp/linux/commits/Masahiro-Yamada/fortify-use-if_changed_dep-to-record-header-dependency-in-cmd-files/20240715-224820 base: linus/master patch link: https://lore.kernel.org/r/20240715144529.101634-2-masahiroy%40kernel.org patch subject: [PATCH 1/3] fortify: use if_changed_dep to record header dependency in *.cmd files config: i386-randconfig-004-20240716 (https://download.01.org/0day-ci/archive/20240717/[email protected]/config) compiler: gcc-7 (Ubuntu 7.5.0-6ubuntu2) 7.5.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240717/[email protected]/reproduce)If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/All errors (new ones prefixed by >>):
Quoted 1 line
Quoted 1 line
fixdep: error opening file:
lib/test_fortify/.write_overflow-memcpy.log.d: No such file or directory--
Quoted 1 line
Quoted 1 line
fixdep: error opening file:
lib/test_fortify/.read_overflow2-memcmp.log.d: No such file or directory--
Quoted 1 line
Quoted 1 line
fixdep: error opening file:
lib/test_fortify/.read_overflow-memchr.log.d: No such file or directory--
Quoted 1 line
Quoted 1 line
fixdep: error opening file:
lib/test_fortify/.write_overflow-strcpy-lit.log.d: No such file or directory--
Quoted 1 line
Quoted 1 line
fixdep: error opening file:
lib/test_fortify/.read_overflow2-memmove.log.d: No such file or directory--
Quoted 1 line
Quoted 1 line
fixdep: error opening file:
lib/test_fortify/.write_overflow-strncpy-src.log.d: No such file or directory--
Quoted 1 line
Quoted 1 line
fixdep: error opening file:
lib/test_fortify/.read_overflow-memcmp.log.d: No such file or directory--
Quoted 8 lines
Quoted 1 line
Quoted 1 line
fixdep: error opening file:
lib/test_fortify/.read_overflow-memscan.log.d: No such file or directory--
Quoted 1 line
Quoted 1 line
fixdep: error opening file:
lib/test_fortify/.write_overflow-strcpy.log.d: No such file or directory--
Quoted 1 line
Quoted 1 line
fixdep: error opening file:
lib/test_fortify/.write_overflow-memmove.log.d: No such file or directory--
Quoted 1 line
Quoted 1 line
fixdep: error opening file:
lib/test_fortify/.write_overflow-memset.log.d: No such file or directory..
This issue seems to occur with GCC <=7
$ echo 'void b(void) __attribute__((__error__(""))); void a(void) { b(); }' | gcc -Wp,-MMD,test.d -c -o /dev/null -x c -
Quoted 5 lines
Quoted 3 lines
did not create *.d with GCC <= 7.
I do not see the issue with GCC >= 8 or Clang.
Any idea why this happens here and not for other sources in the tree?
Because the logic is opposite.
For other locations, you need to write the correct code. When it is compiled successfully, *.d is generated as well.
Under lib/test_fortify/, you intentionally incorrect code.
GCC emits a compile error, and test_fortify.sh checks
the error message.
I believe *.d should be still generated unless a pre-processor error occurs.
Quoted 8 lines
Quoted 1 line
One quick solution is to skip the test for GCC <= 7.
I'd be fine with that -- it is designed to catch regressions/misbehaviours in newly release compilers so I don't mind dropping checks against older versions.
--
Kees Cook
Signature · 2 lines
Best Regards Masahiro Yamada