mirror of
https://github.com/torvalds/linux.git
synced 2026-09-14 16:10:02 +02:00
clang recently added support for -Wstringop-overread [1], which is on by
default like -Wfortify-source. This breaks the usage of -Werror in the
fortify tests, resulting in the following false positive warnings in the
kernel build:
warning: unsafe memcmp() usage lacked '__read_overflow2' warning in lib/test_fortify/read_overflow2-memcmp.c
warning: unsafe memcmp() usage lacked '__read_overflow' warning in lib/test_fortify/read_overflow-memcmp.c
warning: unsafe memchr() usage lacked '__read_overflow' warning in lib/test_fortify/read_overflow-memchr.c
Examining the fortify test logs shows a warning like the following in
each of the failed logs:
In file included from lib/test_fortify/read_overflow2-memcmp.c:5:
lib/test_fortify/test_fortify.h:34:2: error: 'memcmp' reading 17 bytes from a region of size 16 [-Werror,-Wstringop-overread]
34 | TEST;
| ^
lib/test_fortify/read_overflow2-memcmp.c:3:2: note: expanded from macro 'TEST'
3 | memcmp(large, small, sizeof(small) + 1)
| ^
1 error generated.
Disable -Wstringop-overread for the fortify tests, as it defeats the
purpose of testing the Linux specific implementation of fortify, like
-Wfortify-source.
Cc: stable@vger.kernel.org
Closes: https://github.com/ClangBuiltLinux/linux/issues/2168
Link:
|
||
|---|---|---|
| .. | ||
| .gitignore | ||
| Makefile | ||
| read_overflow-memchr_inv.c | ||
| read_overflow-memchr.c | ||
| read_overflow-memcmp.c | ||
| read_overflow-memscan.c | ||
| read_overflow2_field-memcpy.c | ||
| read_overflow2_field-memmove.c | ||
| read_overflow2-memcmp.c | ||
| read_overflow2-memcpy.c | ||
| read_overflow2-memmove.c | ||
| test_fortify.h | ||
| test_fortify.sh | ||
| write_overflow_field-memcpy.c | ||
| write_overflow_field-memmove.c | ||
| write_overflow_field-memset.c | ||
| write_overflow-memcpy.c | ||
| write_overflow-memmove.c | ||
| write_overflow-memset.c | ||
| write_overflow-strcpy-lit.c | ||
| write_overflow-strcpy.c | ||
| write_overflow-strscpy.c | ||