mm/kasan/kasan_test.c:114: warning: Function parameter or member 'test' not described in 'KUNIT_EXPECT_KASAN_FAIL'
From: kernel test robot
Date: Thu Aug 17 2023 - 05:47:28 EST
Hi Andrey,
First bad commit (maybe != root cause):
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 4853c74bd7ab7fdb83f319bd9ace8a08c031e9b6
commit: f7e01ab828fd4bf6d25b1f143a3994241e8572bf kasan: move tests to mm/kasan/
date: 11 months ago
config: x86_64-rhel-8.3-kunit (https://download.01.org/0day-ci/archive/20230817/202308171757.7V5YUcje-lkp@xxxxxxxxx/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce: (https://download.01.org/0day-ci/archive/20230817/202308171757.7V5YUcje-lkp@xxxxxxxxx/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202308171757.7V5YUcje-lkp@xxxxxxxxx/
All warnings (new ones prefixed by >>):
>> mm/kasan/kasan_test.c:114: warning: Function parameter or member 'test' not described in 'KUNIT_EXPECT_KASAN_FAIL'
>> mm/kasan/kasan_test.c:114: warning: Function parameter or member 'expression' not described in 'KUNIT_EXPECT_KASAN_FAIL'
vim +114 mm/kasan/kasan_test.c
83c4e7a0363bdb lib/test_kasan.c Patricia Alfonso 2020-10-13 69
83c4e7a0363bdb lib/test_kasan.c Patricia Alfonso 2020-10-13 70 /**
0fd379253691e7 lib/test_kasan.c Andrey Konovalov 2021-02-24 71 * KUNIT_EXPECT_KASAN_FAIL() - check that the executed expression produces a
0fd379253691e7 lib/test_kasan.c Andrey Konovalov 2021-02-24 72 * KASAN report; causes a test failure otherwise. This relies on a KUnit
ed6d74446cbfb8 lib/test_kasan.c Andrey Konovalov 2022-03-24 73 * resource named "kasan_status". Do not use this name for KUnit resources
0fd379253691e7 lib/test_kasan.c Andrey Konovalov 2021-02-24 74 * outside of KASAN tests.
f05842cfb9ae25 lib/test_kasan.c Andrey Konovalov 2021-02-24 75 *
ed6d74446cbfb8 lib/test_kasan.c Andrey Konovalov 2022-03-24 76 * For hardware tag-based KASAN, when a synchronous tag fault happens, tag
e80a76aa1a9101 lib/test_kasan.c Andrey Konovalov 2021-03-15 77 * checking is auto-disabled. When this happens, this test handler reenables
e80a76aa1a9101 lib/test_kasan.c Andrey Konovalov 2021-03-15 78 * tag checking. As tag checking can be only disabled or enabled per CPU,
e80a76aa1a9101 lib/test_kasan.c Andrey Konovalov 2021-03-15 79 * this handler disables migration (preemption).
2e4bde6a1e3a3f lib/test_kasan.c Andrey Konovalov 2021-02-24 80 *
ed6d74446cbfb8 lib/test_kasan.c Andrey Konovalov 2022-03-24 81 * Since the compiler doesn't see that the expression can change the test_status
2e4bde6a1e3a3f lib/test_kasan.c Andrey Konovalov 2021-02-24 82 * fields, it can reorder or optimize away the accesses to those fields.
2e4bde6a1e3a3f lib/test_kasan.c Andrey Konovalov 2021-02-24 83 * Use READ/WRITE_ONCE() for the accesses and compiler barriers around the
2e4bde6a1e3a3f lib/test_kasan.c Andrey Konovalov 2021-02-24 84 * expression to prevent that.
99734b535d9bf8 lib/test_kasan.c Andrey Konovalov 2021-04-29 85 *
ed6d74446cbfb8 lib/test_kasan.c Andrey Konovalov 2022-03-24 86 * In between KUNIT_EXPECT_KASAN_FAIL checks, test_status.report_found is kept
ed6d74446cbfb8 lib/test_kasan.c Andrey Konovalov 2022-03-24 87 * as false. This allows detecting KASAN reports that happen outside of the
ed6d74446cbfb8 lib/test_kasan.c Andrey Konovalov 2022-03-24 88 * checks by asserting !test_status.report_found at the start of
ed6d74446cbfb8 lib/test_kasan.c Andrey Konovalov 2022-03-24 89 * KUNIT_EXPECT_KASAN_FAIL and in kasan_test_exit.
83c4e7a0363bdb lib/test_kasan.c Patricia Alfonso 2020-10-13 90 */
0fd379253691e7 lib/test_kasan.c Andrey Konovalov 2021-02-24 91 #define KUNIT_EXPECT_KASAN_FAIL(test, expression) do { \
e80a76aa1a9101 lib/test_kasan.c Andrey Konovalov 2021-03-15 92 if (IS_ENABLED(CONFIG_KASAN_HW_TAGS) && \
2d27e585147395 lib/test_kasan.c Vincenzo Frascino 2021-10-06 93 kasan_sync_fault_possible()) \
f05842cfb9ae25 lib/test_kasan.c Andrey Konovalov 2021-02-24 94 migrate_disable(); \
ed6d74446cbfb8 lib/test_kasan.c Andrey Konovalov 2022-03-24 95 KUNIT_EXPECT_FALSE(test, READ_ONCE(test_status.report_found)); \
2e4bde6a1e3a3f lib/test_kasan.c Andrey Konovalov 2021-02-24 96 barrier(); \
0fd379253691e7 lib/test_kasan.c Andrey Konovalov 2021-02-24 97 expression; \
2e4bde6a1e3a3f lib/test_kasan.c Andrey Konovalov 2021-02-24 98 barrier(); \
ed6d74446cbfb8 lib/test_kasan.c Andrey Konovalov 2022-03-24 99 if (kasan_async_fault_possible()) \
ed6d74446cbfb8 lib/test_kasan.c Andrey Konovalov 2022-03-24 100 kasan_force_async_fault(); \
ed6d74446cbfb8 lib/test_kasan.c Andrey Konovalov 2022-03-24 101 if (!READ_ONCE(test_status.report_found)) { \
3ff16d30f593d8 lib/test_kasan.c David Gow 2021-06-28 102 KUNIT_FAIL(test, KUNIT_SUBTEST_INDENT "KASAN failure " \
3ff16d30f593d8 lib/test_kasan.c David Gow 2021-06-28 103 "expected in \"" #expression \
3ff16d30f593d8 lib/test_kasan.c David Gow 2021-06-28 104 "\", but none occurred"); \
3ff16d30f593d8 lib/test_kasan.c David Gow 2021-06-28 105 } \
ed6d74446cbfb8 lib/test_kasan.c Andrey Konovalov 2022-03-24 106 if (IS_ENABLED(CONFIG_KASAN_HW_TAGS) && \
ed6d74446cbfb8 lib/test_kasan.c Andrey Konovalov 2022-03-24 107 kasan_sync_fault_possible()) { \
ed6d74446cbfb8 lib/test_kasan.c Andrey Konovalov 2022-03-24 108 if (READ_ONCE(test_status.report_found) && \
ed6d74446cbfb8 lib/test_kasan.c Andrey Konovalov 2022-03-24 109 READ_ONCE(test_status.sync_fault)) \
ed6d74446cbfb8 lib/test_kasan.c Andrey Konovalov 2022-03-24 110 kasan_enable_tagging(); \
f05842cfb9ae25 lib/test_kasan.c Andrey Konovalov 2021-02-24 111 migrate_enable(); \
f05842cfb9ae25 lib/test_kasan.c Andrey Konovalov 2021-02-24 112 } \
ed6d74446cbfb8 lib/test_kasan.c Andrey Konovalov 2022-03-24 113 WRITE_ONCE(test_status.report_found, false); \
83c4e7a0363bdb lib/test_kasan.c Patricia Alfonso 2020-10-13 @114 } while (0)
83c4e7a0363bdb lib/test_kasan.c Patricia Alfonso 2020-10-13 115
:::::: The code at line 114 was first introduced by commit
:::::: 83c4e7a0363bdb8104f510370907161623e31086 KUnit: KASAN Integration
:::::: TO: Patricia Alfonso <trishalfonso@xxxxxxxxxx>
:::::: CC: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki