summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorGustavo A. R. Silva <gustavoars@kernel.org>2021-09-30 00:18:03 +0300
committerGustavo A. R. Silva <gustavoars@kernel.org>2021-11-15 22:45:12 +0300
commit552a23a0e5d0a84cecd4687043d8030673981d30 (patch)
treedb0e4f87053ea2101e57f9bdeed517dfda69a7e1 /Makefile
parentfa55b7dcdc43c1aa1ba12bca9d2dd4318c2a0dbf (diff)
downloadlinux-552a23a0e5d0a84cecd4687043d8030673981d30.tar.xz
Makefile: Enable -Wcast-function-type
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>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile5
1 files changed, 5 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index 9e12c14ea0fb..5a8cde6a2fbb 100644
--- 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)