Skip to contentSkip to conversation

kunit: fix longest symbol length test

PATCH Superseded Sergio González Collado 3 participants 3 messages May 2, 2025 – May 13, 2025

Subsystems (4)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 kunit: fix longest symbol length test

The kunit test that checks the longests symbol length [1], has triggered warnings in some pilelines when symbol prefixes are used [2]. The test is adjunsted to depend on !PREFIX_SYMBOLS and !CFI_CLANG as sujested in [3]

[1] https://lore.kernel.org/rust-for-linux/CABVgOSm=5Q0fM6neBhxSbOUHBgNzmwf2V22vsYC10YRBT=kN1g@mail.gmail.com/T/#t
[2] https://lore.kernel.org/all/[email protected]/T/#u
[3] https://lore.kernel.org/linux-kselftest/20250427200916.GA1661412@ax162/T/#t

---
V1 -> V2: added dependency on !CFI_CLANG as suggested in [3], removed
CONFIG_ prefix

---
 lib/Kconfig.debug                | 2 +-
 lib/tests/longest_symbol_kunit.c | 3 +--
 2 files changed, 2 insertions(+), 3 deletions(-)
lib/Kconfig.debug +1 -1
index f9051ab610d5..5b33673d82da 100644
@@ -2885,7 +2885,7 @@ config FORTIFY_KUNIT_TEST
 
 config LONGEST_SYM_KUNIT_TEST
 	tristate "Test the longest symbol possible" if !KUNIT_ALL_TESTS
-	depends on KUNIT && KPROBES
+	depends on KUNIT && KPROBES && !PREFIX_SYMBOLS && !CFI_CLANG
 	default KUNIT_ALL_TESTS
 	help
 	  Tests the longest symbol possible
lib/tests/longest_symbol_kunit.c +1 -2
index e3c28ff1807f..b183fb92d1b2 100644
@@ -3,8 +3,7 @@
  * Test the longest symbol length. Execute with:
  *  ./tools/testing/kunit/kunit.py run longest-symbol
  *  --arch=x86_64 --kconfig_add CONFIG_KPROBES=y --kconfig_add CONFIG_MODULES=y
- *  --kconfig_add CONFIG_RETPOLINE=n --kconfig_add CONFIG_CFI_CLANG=n
- *  --kconfig_add CONFIG_MITIGATION_RETPOLINE=n
+ *  --kconfig_add CONFIG_CPU_MITIGATIONS=n
  */
 
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

base-commit: ebd297a2affadb6f6f4d2e5d975c1eda18ac762d

Signature · 1 line
2.39.2
Reviewed-by on v2 1/1
#1 lore raw
Quoted 10 lines · Sergio González Collado

The kunit test that checks the longests symbol length [1], has triggered warnings in some pilelines when symbol prefixes are used [2]. The test is adjunsted to depend on !PREFIX_SYMBOLS and !CFI_CLANG as sujested in [3]

[1] https://lore.kernel.org/rust-for-linux/CABVgOSm=5Q0fM6neBhxSbOUHBgNzmwf2V22vsYC10YRBT=kN1g@mail.gmail.com/T/#t
[2] https://lore.kernel.org/all/[email protected]/T/#u
[3] https://lore.kernel.org/linux-kselftest/20250427200916.GA1661412@ax162/T/#t

Hello!

This is working for me both when the test is built-in (run using kunit.py) and when it is loaded as a module. Those that had issues with this breaking with prefix symbols, feel free to dispute this if you are still having issues. However, otherwise I am happy to see this go through the KUnit tree.

Thanks!
-Rae

Quoted 41 lines

---
V1 -> V2: added dependency on !CFI_CLANG as suggested in [3], removed
CONFIG_ prefix

---
 lib/Kconfig.debug                | 2 +-
 lib/tests/longest_symbol_kunit.c | 3 +--
 2 files changed, 2 insertions(+), 3 deletions(-)
lib/Kconfig.debug +1 -1
index f9051ab610d5..5b33673d82da 100644
@@ -2885,7 +2885,7 @@ config FORTIFY_KUNIT_TEST
 
 config LONGEST_SYM_KUNIT_TEST
        tristate "Test the longest symbol possible" if !KUNIT_ALL_TESTS
-       depends on KUNIT && KPROBES
+       depends on KUNIT && KPROBES && !PREFIX_SYMBOLS && !CFI_CLANG
        default KUNIT_ALL_TESTS
        help
          Tests the longest symbol possible
lib/tests/longest_symbol_kunit.c +1 -2
index e3c28ff1807f..b183fb92d1b2 100644
@@ -3,8 +3,7 @@
  * Test the longest symbol length. Execute with:
  *  ./tools/testing/kunit/kunit.py run longest-symbol
  *  --arch=x86_64 --kconfig_add CONFIG_KPROBES=y --kconfig_add CONFIG_MODULES=y
- *  --kconfig_add CONFIG_RETPOLINE=n --kconfig_add CONFIG_CFI_CLANG=n
- *  --kconfig_add CONFIG_MITIGATION_RETPOLINE=n
+ *  --kconfig_add CONFIG_CPU_MITIGATIONS=n
  */
 
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

base-commit: ebd297a2affadb6f6f4d2e5d975c1eda18ac762d --
2.39.2

#2 lore raw
In reply to Sergio González Collado

Hi,

Quoted 4 lines · Sergio González Collado

The kunit test that checks the longests symbol length [1], has triggered warnings in some pilelines when symbol prefixes are used [2]. The test is adjunsted to depend on !PREFIX_SYMBOLS and !CFI_CLANG as sujested in [3]

Quoted 8 lines

[1] https://lore.kernel.org/rust-for-linux/CABVgOSm=5Q0fM6neBhxSbOUHBgNzmwf2V22vsYC10YRBT=kN1g@mail.gmail.com/T/#t
[2] https://lore.kernel.org/all/[email protected]/T/#u
[3] https://lore.kernel.org/linux-kselftest/20250427200916.GA1661412@ax162/T/#t

---
V1 -> V2: added dependency on !CFI_CLANG as suggested in [3], removed
CONFIG_ prefix

I applied this patch and tested a previously failing case. It still fails. This is on an i386 build:

Symbol __gcov_.snnnng1h2i3j4k5l6m7ng1h2i3j4k5l6m7nng1h2i3j4k5l6m7ng1h2i3j4k5l6m7nnng1h2i3j4k5l6m7ng1h2i3j4k5l6m7nng1h2i3j4k5l6m7ng1h2i3j4k5l6m7nnnng1h2i3j4k5l6m7ng1h2i3j4k5l6m7nng1h2i3j4k5l6m7ng1h2i3j4k5l6m7nnng1h2i3j4k5l6m7ng1h2i3j4k5l6m7nng1h2i3j4k5l6m7ng1h2i3j4k5l6m7nnnnng1h2i3j4k5l6m7ng1h2i3j4k5l6m7nng1h2i3j4k5l6m7ng1h2i3j4k5l6m7nnng1h2i3j4k5l6m7ng1h2i3j4k5l6m7nng1h2i3j4k5l6m7ng1h2i3j4k5l6m7nnnng1h2i3j4k5l6m7ng1h2i3j4k5l6m7nng1h2i3j4k5l6m7ng1h2i3j4k5l6m7nnng1h2i3j4k5l6m7ng1h2i3j4k5l6m7nng1h2i3j4k5l6m7ng1h2i3j4k5l6m7n too long for kallsyms (519 >= 512). Please increase KSYM_NAME_LEN both in kernel and kallsyms.c
Symbol __gcov0.snnnng1h2i3j4k5l6m7ng1h2i3j4k5l6m7nng1h2i3j4k5l6m7ng1h2i3j4k5l6m7nnng1h2i3j4k5l6m7ng1h2i3j4k5l6m7nng1h2i3j4k5l6m7ng1h2i3j4k5l6m7nnnng1h2i3j4k5l6m7ng1h2i3j4k5l6m7nng1h2i3j4k5l6m7ng1h2i3j4k5l6m7nnng1h2i3j4k5l6m7ng1h2i3j4k5l6m7nng1h2i3j4k5l6m7ng1h2i3j4k5l6m7nnnnng1h2i3j4k5l6m7ng1h2i3j4k5l6m7nng1h2i3j4k5l6m7ng1h2i3j4k5l6m7nnng1h2i3j4k5l6m7ng1h2i3j4k5l6m7nng1h2i3j4k5l6m7ng1h2i3j4k5l6m7nnnng1h2i3j4k5l6m7ng1h2i3j4k5l6m7nng1h2i3j4k5l6m7ng1h2i3j4k5l6m7nnng1h2i3j4k5l6m7ng1h2i3j4k5l6m7nng1h2i3j4k5l6m7ng1h2i3j4k5l6m7n too long for kallsyms (519 >= 512). Please increase KSYM_NAME_LEN both in kernel and kallsyms.c
Symbol __gcov_.snnnng1h2i3j4k5l6m7ng1h2i3j4k5l6m7nng1h2i3j4k5l6m7ng1h2i3j4k5l6m7nnng1h2i3j4k5l6m7ng1h2i3j4k5l6m7nng1h2i3j4k5l6m7ng1h2i3j4k5l6m7nnnng1h2i3j4k5l6m7ng1h2i3j4k5l6m7nng1h2i3j4k5l6m7ng1h2i3j4k5l6m7nnng1h2i3j4k5l6m7ng1h2i3j4k5l6m7nng1h2i3j4k5l6m7ng1h2i3j4k5l6m7nnnnng1h2i3j4k5l6m7ng1h2i3j4k5l6m7nng1h2i3j4k5l6m7ng1h2i3j4k5l6m7nnng1h2i3j4k5l6m7ng1h2i3j4k5l6m7nng1h2i3j4k5l6m7ng1h2i3j4k5l6m7nnnng1h2i3j4k5l6m7ng1h2i3j4k5l6m7nng1h2i3j4k5l6m7ng1h2i3j4k5l6m7nnng1h2i3j4k5l6m7ng1h2i3j4k5l6m7nng1h2i3j4k5l6m7ng1h2i3j4k5l6m7n too long for kallsyms (519 >= 512). Please increase KSYM_NAME_LEN both in kernel and kallsyms.c
Symbol __gcov0.snnnng1h2i3j4k5l6m7ng1h2i3j4k5l6m7nng1h2i3j4k5l6m7ng1h2i3j4k5l6m7nnng1h2i3j4k5l6m7ng1h2i3j4k5l6m7nng1h2i3j4k5l6m7ng1h2i3j4k5l6m7nnnng1h2i3j4k5l6m7ng1h2i3j4k5l6m7nng1h2i3j4k5l6m7ng1h2i3j4k5l6m7nnng1h2i3j4k5l6m7ng1h2i3j4k5l6m7nng1h2i3j4k5l6m7ng1h2i3j4k5l6m7nnnnng1h2i3j4k5l6m7ng1h2i3j4k5l6m7nng1h2i3j4k5l6m7ng1h2i3j4k5l6m7nnng1h2i3j4k5l6m7ng1h2i3j4k5l6m7nng1h2i3j4k5l6m7ng1h2i3j4k5l6m7nnnng1h2i3j4k5l6m7ng1h2i3j4k5l6m7nng1h2i3j4k5l6m7ng1h2i3j4k5l6m7nnng1h2i3j4k5l6m7ng1h2i3j4k5l6m7nng1h2i3j4k5l6m7ng1h2i3j4k5l6m7n too long for kallsyms (519 >= 512). Please increase KSYM_NAME_LEN both in kernel and kallsyms.c

Quoted 1 line

gcc --version

gcc (SUSE Linux) 14.2.1 20250430 [revision 3418d740b344e0ba38022f3bed90540ec3de35dd]

The failing i386 randconfig file is attached.

Quoted 34 lines
---
 lib/Kconfig.debug                | 2 +-
 lib/tests/longest_symbol_kunit.c | 3 +--
 2 files changed, 2 insertions(+), 3 deletions(-)
lib/Kconfig.debug +1 -1
index f9051ab610d5..5b33673d82da 100644
@@ -2885,7 +2885,7 @@ config FORTIFY_KUNIT_TEST
 
 config LONGEST_SYM_KUNIT_TEST
 	tristate "Test the longest symbol possible" if !KUNIT_ALL_TESTS
-	depends on KUNIT && KPROBES
+	depends on KUNIT && KPROBES && !PREFIX_SYMBOLS && !CFI_CLANG
 	default KUNIT_ALL_TESTS
 	help
 	  Tests the longest symbol possible
lib/tests/longest_symbol_kunit.c +1 -2
index e3c28ff1807f..b183fb92d1b2 100644
@@ -3,8 +3,7 @@
  * Test the longest symbol length. Execute with:
  *  ./tools/testing/kunit/kunit.py run longest-symbol
  *  --arch=x86_64 --kconfig_add CONFIG_KPROBES=y --kconfig_add CONFIG_MODULES=y
- *  --kconfig_add CONFIG_RETPOLINE=n --kconfig_add CONFIG_CFI_CLANG=n
- *  --kconfig_add CONFIG_MITIGATION_RETPOLINE=n
+ *  --kconfig_add CONFIG_CPU_MITIGATIONS=n
  */
 
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

base-commit: ebd297a2affadb6f6f4d2e5d975c1eda18ac762d

Signature · 1 line
~Randy