commit8901ac9d2cupstream. GCC < 12.1 can miscompile printf_kunit's errptr() test when branch profiling is enabled. BUILD_BUG_ON(IS_ERR(PTR)) is a constant false expression, but CONFIG_TRACE_BRANCH_PROFILING and CONFIG_PROFILE_ALL_BRANCHES make the IS_ERR() path side-effectful. GCC's IPA splitter can then outline the cold assert arm into errptr.part.* and leave that clone with an unconditional __compiletime_assert_*() call, causing a false build failure. This started showing up after test_hashed() became a macro and moved its local buffer into errptr(), which changed GCC's inlining and splitting decisions enough to expose the compiler bug. Workaround the problem by disabling the branch profiling for printf_kunit.o. It is a straightforward and acceptable solution. The workaround can be removed once the minimum GCC includes commit 76fe49423047 ("Fix tree-optimization/101941: IPA splitting out function with error attribute"), which first shipped in GCC 12.1. Fixes:9bfa52dac2("printf: convert test_hashed into macro") Reported-by: kernel test robot <lkp@intel.com> Closes: https://lore.kernel.org/oe-kbuild-all/202604030636.NqjaJvYp-lkp@intel.com/ Cc: stable@vger.kernel.org Acked-by: Tamir Duberstein <tamird@kernel.org> Link: https://patch.msgid.link/ad5gJAX9f6dSQluz@pathway.suse.cz Signed-off-by: Petr Mladek <pmladek@suse.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
61 lines
2.9 KiB
Makefile
61 lines
2.9 KiB
Makefile
# SPDX-License-Identifier: GPL-2.0
|
|
#
|
|
# Makefile for tests of kernel library functions.
|
|
|
|
# KUnit tests
|
|
CFLAGS_bitfield_kunit.o := $(DISABLE_STRUCTLEAK_PLUGIN)
|
|
obj-$(CONFIG_BASE64_KUNIT) += base64_kunit.o
|
|
obj-$(CONFIG_BITOPS_KUNIT) += bitops_kunit.o
|
|
obj-$(CONFIG_BITFIELD_KUNIT) += bitfield_kunit.o
|
|
obj-$(CONFIG_BITS_TEST) += test_bits.o
|
|
obj-$(CONFIG_BLACKHOLE_DEV_KUNIT_TEST) += blackhole_dev_kunit.o
|
|
obj-$(CONFIG_CHECKSUM_KUNIT) += checksum_kunit.o
|
|
obj-$(CONFIG_CMDLINE_KUNIT_TEST) += cmdline_kunit.o
|
|
obj-$(CONFIG_CPUMASK_KUNIT_TEST) += cpumask_kunit.o
|
|
obj-$(CONFIG_FFS_KUNIT_TEST) += ffs_kunit.o
|
|
CFLAGS_fortify_kunit.o += $(call cc-disable-warning, unsequenced)
|
|
CFLAGS_fortify_kunit.o += $(call cc-disable-warning, stringop-overread)
|
|
CFLAGS_fortify_kunit.o += $(call cc-disable-warning, stringop-truncation)
|
|
CFLAGS_fortify_kunit.o += $(DISABLE_STRUCTLEAK_PLUGIN)
|
|
obj-$(CONFIG_FORTIFY_KUNIT_TEST) += fortify_kunit.o
|
|
CFLAGS_test_fprobe.o += $(CC_FLAGS_FTRACE)
|
|
obj-$(CONFIG_FPROBE_SANITY_TEST) += test_fprobe.o
|
|
obj-$(CONFIG_GLOB_KUNIT_TEST) += glob_kunit.o
|
|
obj-$(CONFIG_HASHTABLE_KUNIT_TEST) += hashtable_test.o
|
|
obj-$(CONFIG_HASH_KUNIT_TEST) += test_hash.o
|
|
obj-$(CONFIG_TEST_IOV_ITER) += kunit_iov_iter.o
|
|
obj-$(CONFIG_IS_SIGNED_TYPE_KUNIT_TEST) += is_signed_type_kunit.o
|
|
obj-$(CONFIG_KPROBES_SANITY_TEST) += test_kprobes.o
|
|
obj-$(CONFIG_LIST_KUNIT_TEST) += list-test.o
|
|
obj-$(CONFIG_LIST_PRIVATE_KUNIT_TEST) += list-private-test.o
|
|
obj-$(CONFIG_KFIFO_KUNIT_TEST) += kfifo_kunit.o
|
|
obj-$(CONFIG_TEST_LIST_SORT) += test_list_sort.o
|
|
obj-$(CONFIG_LINEAR_RANGES_TEST) += test_linear_ranges.o
|
|
obj-$(CONFIG_LIVEUPDATE_TEST) += liveupdate.o
|
|
|
|
CFLAGS_longest_symbol_kunit.o += $(call cc-disable-warning, missing-prototypes)
|
|
obj-$(CONFIG_LONGEST_SYM_KUNIT_TEST) += longest_symbol_kunit.o
|
|
|
|
obj-$(CONFIG_MEMCPY_KUNIT_TEST) += memcpy_kunit.o
|
|
obj-$(CONFIG_MIN_HEAP_KUNIT_TEST) += min_heap_kunit.o
|
|
CFLAGS_overflow_kunit.o = $(call cc-disable-warning, tautological-constant-out-of-range-compare)
|
|
obj-$(CONFIG_OVERFLOW_KUNIT_TEST) += overflow_kunit.o
|
|
# GCC < 12.1 can miscompile errptr() test when branch profiling is enabled.
|
|
CFLAGS_printf_kunit.o += -DDISABLE_BRANCH_PROFILING
|
|
obj-$(CONFIG_PRINTF_KUNIT_TEST) += printf_kunit.o
|
|
obj-$(CONFIG_RANDSTRUCT_KUNIT_TEST) += randstruct_kunit.o
|
|
obj-$(CONFIG_SCANF_KUNIT_TEST) += scanf_kunit.o
|
|
obj-$(CONFIG_SEQ_BUF_KUNIT_TEST) += seq_buf_kunit.o
|
|
obj-$(CONFIG_SIPHASH_KUNIT_TEST) += siphash_kunit.o
|
|
obj-$(CONFIG_SLUB_KUNIT_TEST) += slub_kunit.o
|
|
obj-$(CONFIG_TEST_SORT) += test_sort.o
|
|
CFLAGS_stackinit_kunit.o += $(call cc-disable-warning, switch-unreachable)
|
|
obj-$(CONFIG_STACKINIT_KUNIT_TEST) += stackinit_kunit.o
|
|
obj-$(CONFIG_STRING_KUNIT_TEST) += string_kunit.o
|
|
obj-$(CONFIG_STRING_HELPERS_KUNIT_TEST) += string_helpers_kunit.o
|
|
obj-$(CONFIG_USERCOPY_KUNIT_TEST) += usercopy_kunit.o
|
|
obj-$(CONFIG_UTIL_MACROS_KUNIT) += util_macros_kunit.o
|
|
obj-$(CONFIG_RATELIMIT_KUNIT_TEST) += test_ratelimit.o
|
|
obj-$(CONFIG_UUID_KUNIT_TEST) += uuid_kunit.o
|
|
|
|
obj-$(CONFIG_TEST_RUNTIME_MODULE) += module/
|