Skip to contentSkip to conversation

init/Kconfig: Lower GCC version check for -Warray-bounds

PATCH Applied Kees Cook 2 participants 2 messages Feb 23, 2024

lore
Share & tools
lore

Kees Cook

author
#0 lore raw

PATCH 1/1 init/Kconfig: Lower GCC version check for -Warray-bounds

We continue to see false positives from -Warray-bounds even in GCC 10, which is getting reported in a few places[1] still:

security/security.c:811:2: warning: ‘memcpy’ offset 32 is out of the bounds [0, 0] [-Warray-bounds]

Lower the GCC version check from 11 to 10.

---
Cc: Masahiro Yamada <[email protected]>
Cc: Paul Moore <[email protected]>
Cc: Gustavo A. R. Silva <[email protected]>
Cc: Nathan Chancellor <[email protected]>
Cc: Christophe Leroy <[email protected]>
Cc: Johannes Weiner <[email protected]>

---
 init/Kconfig | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
init/Kconfig +3 -3
index 8d4e836e1b6b..7b352f2943f2 100644
@@ -867,14 +867,14 @@ config CC_IMPLICIT_FALLTHROUGH
 	default "-Wimplicit-fallthrough=5" if CC_IS_GCC && $(cc-option,-Wimplicit-fallthrough=5)
 	default "-Wimplicit-fallthrough" if CC_IS_CLANG && $(cc-option,-Wunreachable-code-fallthrough)
 
-# Currently, disable gcc-11+ array-bounds globally.
+# Currently, disable gcc-10+ array-bounds globally.
 # It's still broken in gcc-13, so no upper bound yet.
-config GCC11_NO_ARRAY_BOUNDS
+config GCC10_NO_ARRAY_BOUNDS
 	def_bool y
 
 config CC_NO_ARRAY_BOUNDS
 	bool
-	default y if CC_IS_GCC && GCC_VERSION >= 110000 && GCC11_NO_ARRAY_BOUNDS
+	default y if CC_IS_GCC && GCC_VERSION >= 100000 && GCC10_NO_ARRAY_BOUNDS
 
 # Currently, disable -Wstringop-overflow for GCC 11, globally.
 config GCC11_NO_STRINGOP_OVERFLOW
Signature · 1 line
2.34.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 19 lines · Kees Cook

We continue to see false positives from -Warray-bounds even in GCC 10, which is getting reported in a few places[1] still:

security/security.c:811:2: warning: ‘memcpy’ offset 32 is out of the bounds [0, 0] [-Warray-bounds]

Lower the GCC version check from 11 to 10.

---
Cc: Masahiro Yamada <[email protected]>
Cc: Paul Moore <[email protected]>
Cc: Gustavo A. R. Silva <[email protected]>
Cc: Nathan Chancellor <[email protected]>
Cc: Christophe Leroy <[email protected]>
Cc: Johannes Weiner <[email protected]>

Quoted 3 lines
---
 init/Kconfig | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Thanks Kees.

Signature · 1 line
paul-moore.com