mirror of
https://github.com/torvalds/linux.git
synced 2024-11-10 22:21:40 +00:00
3ca17b1f36
With gcc-8 fsanitize=null become very noisy. GCC started to complain about things like &a->b, where 'a' is NULL pointer. There is no NULL dereference, we just calculate address to struct member. It's technically undefined behavior so UBSAN is correct to report it. But as long as there is no real NULL-dereference, I think, we should be fine. -fno-delete-null-pointer-checks compiler flag should protect us from any consequences. So let's just no use -fsanitize=null as it's not useful for us. If there is a real NULL-deref we will see crash. Even if userspace mapped something at NULL (root can do this), with things like SMAP should catch the issue. Link: http://lkml.kernel.org/r/20180802153209.813-1-aryabinin@virtuozzo.com Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
21 lines
926 B
Makefile
21 lines
926 B
Makefile
# SPDX-License-Identifier: GPL-2.0
|
|
ifdef CONFIG_UBSAN
|
|
CFLAGS_UBSAN += $(call cc-option, -fsanitize=shift)
|
|
CFLAGS_UBSAN += $(call cc-option, -fsanitize=integer-divide-by-zero)
|
|
CFLAGS_UBSAN += $(call cc-option, -fsanitize=unreachable)
|
|
CFLAGS_UBSAN += $(call cc-option, -fsanitize=vla-bound)
|
|
CFLAGS_UBSAN += $(call cc-option, -fsanitize=signed-integer-overflow)
|
|
CFLAGS_UBSAN += $(call cc-option, -fsanitize=bounds)
|
|
CFLAGS_UBSAN += $(call cc-option, -fsanitize=object-size)
|
|
CFLAGS_UBSAN += $(call cc-option, -fsanitize=bool)
|
|
CFLAGS_UBSAN += $(call cc-option, -fsanitize=enum)
|
|
|
|
ifdef CONFIG_UBSAN_ALIGNMENT
|
|
CFLAGS_UBSAN += $(call cc-option, -fsanitize=alignment)
|
|
endif
|
|
|
|
# -fsanitize=* options makes GCC less smart than usual and
|
|
# increase number of 'maybe-uninitialized false-positives
|
|
CFLAGS_UBSAN += $(call cc-option, -Wno-maybe-uninitialized)
|
|
endif
|