]> git.baikalelectronics.ru Git - kernel.git/commitdiff
Makefile: Enable -Wcast-function-type
authorGustavo A. R. Silva <gustavoars@kernel.org>
Wed, 29 Sep 2021 21:18:03 +0000 (16:18 -0500)
committerGustavo A. R. Silva <gustavoars@kernel.org>
Mon, 15 Nov 2021 19:45:12 +0000 (13:45 -0600)
In order to make sure new function cast mismatches are not introduced
in the kernel (to avoid tripping CFI checking), the kernel should be
globally built with -Wcast-function-type.

Link: https://github.com/KSPP/linux/issues/20
Co-developed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Makefile

index 9e12c14ea0fbb231122ab4c548fa3909b1718a3b..5a8cde6a2fbb45444fada9db4b4f4796aa38d637 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -953,6 +953,11 @@ KBUILD_CFLAGS += -Wvla
 # disable pointer signed / unsigned warnings in gcc 4.0
 KBUILD_CFLAGS += -Wno-pointer-sign
 
+# In order to make sure new function cast mismatches are not introduced
+# in the kernel (to avoid tripping CFI checking), the kernel should be
+# globally built with -Wcast-function-type.
+KBUILD_CFLAGS += $(call cc-option, -Wcast-function-type)
+
 # disable stringop warnings in gcc 8+
 KBUILD_CFLAGS += $(call cc-disable-warning, stringop-truncation)