summaryrefslogtreecommitdiffstats
path: root/lib/overflow_kunit.c
diff options
context:
space:
mode:
authorNick Desaulniers <ndesaulniers@google.com>2022-10-06 10:17:51 -0700
committerKees Cook <keescook@chromium.org>2022-10-25 14:57:42 -0700
commit0e5b9f25b27a7a92880f88f5dba3edf726ec5f61 (patch)
treeb75a8d60cf459b3a8d55752161e4931f0ae86738 /lib/overflow_kunit.c
parent31970608a6d3796c3adbfbfd379fa3092de65c5d (diff)
downloadlinux-0e5b9f25b27a7a92880f88f5dba3edf726ec5f61.tar.gz
linux-0e5b9f25b27a7a92880f88f5dba3edf726ec5f61.tar.bz2
linux-0e5b9f25b27a7a92880f88f5dba3edf726ec5f61.zip
overflow: disable failing tests for older clang versions
Building the overflow kunit tests with clang-11 fails with: $ ./tools/testing/kunit/kunit.py run --arch=arm --make_options LLVM=1 \ overflow ... ld.lld: error: undefined symbol: __mulodi4 ... Clang 11 and earlier generate unwanted libcalls for signed output, unsigned input. Disable these tests for now, but should these become used in the kernel we might consider that as justification for dropping clang-11 support. Keep the clang-11 build alive a little bit longer. Avoid -Wunused-function warnings via __maybe_unused. To test W=1: $ make LLVM=1 -j128 defconfig $ ./scripts/config -e KUNIT -e KUNIT_ALL $ make LLVM=1 -j128 olddefconfig lib/overflow_kunit.o W=1 Link: https://github.com/ClangBuiltLinux/linux/issues/1711 Link: https://github.com/llvm/llvm-project/commit/3203143f1356a4e4e3ada231156fc6da6e1a9f9d Reported-by: Nathan Chancellor <nathan@kernel.org> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com> Signed-off-by: Kees Cook <keescook@chromium.org> Link: https://lore.kernel.org/r/20221006171751.3444575-1-ndesaulniers@google.com
Diffstat (limited to 'lib/overflow_kunit.c')
-rw-r--r--lib/overflow_kunit.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/overflow_kunit.c b/lib/overflow_kunit.c
index 5369634701fa..ca5f1aa3e91d 100644
--- a/lib/overflow_kunit.c
+++ b/lib/overflow_kunit.c
@@ -254,6 +254,7 @@ static void do_test_ ## n(struct kunit *test, const struct test_ ## n *p) \
check_one_op(t, fmt, mul, "*", p->b, p->a, p->prod, p->p_of); \
} \
\
+__maybe_unused \
static void n ## _overflow_test(struct kunit *test) { \
unsigned i; \
\
@@ -720,8 +721,14 @@ static struct kunit_case overflow_test_cases[] = {
KUNIT_CASE(u64_u64__u64_overflow_test),
KUNIT_CASE(s64_s64__s64_overflow_test),
#endif
- KUNIT_CASE(u32_u32__u8_overflow_test),
+/*
+ * Clang 11 and earlier generate unwanted libcalls for signed output, unsigned
+ * input.
+ */
+#if !(defined(CONFIG_CC_IS_CLANG) && __clang_major__ <= 11)
KUNIT_CASE(u32_u32__int_overflow_test),
+#endif
+ KUNIT_CASE(u32_u32__u8_overflow_test),
KUNIT_CASE(u8_u8__int_overflow_test),
KUNIT_CASE(int_int__u8_overflow_test),
KUNIT_CASE(shift_sane_test),