Skip to content

Commit 552a23a

Browse files
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: KSPP#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>
1 parent fa55b7d commit 552a23a

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -953,6 +953,11 @@ KBUILD_CFLAGS += -Wvla
953953
# disable pointer signed / unsigned warnings in gcc 4.0
954954
KBUILD_CFLAGS += -Wno-pointer-sign
955955

956+
# In order to make sure new function cast mismatches are not introduced
957+
# in the kernel (to avoid tripping CFI checking), the kernel should be
958+
# globally built with -Wcast-function-type.
959+
KBUILD_CFLAGS += $(call cc-option, -Wcast-function-type)
960+
956961
# disable stringop warnings in gcc 8+
957962
KBUILD_CFLAGS += $(call cc-disable-warning, stringop-truncation)
958963

0 commit comments

Comments
 (0)