Skip to contentSkip to conversation

x86: Disable image size check for test builds

PATCH Applied Guenter Roeck 1 participant 1 message Apr 17, 2025 x86

v3 of 4 Applied 1/1 Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 x86: Disable image size check for test builds

64-bit allyesconfig builds fail with

x86_64-linux-ld: kernel image bigger than KERNEL_IMAGE_SIZE

Bisect points to commit 6f110a5e4f99 ("Disable SLUB_TINY for build testing") as the responsible commit. Reverting that patch does indeed fix the problem. Further analysis shows that disabling SLUB_TINY enables KASAN, and that KASAN is responsible for the image size increase.

Solve the build problem by disabling the image size check for test builds.

Fixes 6f110a5e4f99 ("Disable SLUB_TINY for build testing")
Cc Linus Torvalds <[email protected]>

---
v3: Disabled image size check instead of disabling KASAN
Updated subject to match change
Updated Cc: list to reflect affected maintainers

v2: Disabled KASAN unconditionally for test builds

    Link: https://lore.kernel.org/lkml/[email protected]/

Link to RFC:

    https://lore.kernel.org/lkml/[email protected]/
 arch/x86/kernel/vmlinux.lds.S | 2 ++
 1 file changed, 2 insertions(+)
arch/x86/kernel/vmlinux.lds.S +2 -0
index ccdc45e5b759..647d4f47486d 100644
@@ -468,8 +468,10 @@ SECTIONS
 /*
  * The ASSERT() sink to . is intentional, for binutils 2.14 compatibility:
  */
+#ifndef CONFIG_COMPILE_TEST
 . = ASSERT((_end - LOAD_OFFSET <= KERNEL_IMAGE_SIZE),
 	   "kernel image bigger than KERNEL_IMAGE_SIZE");
+#endif
 
 /* needed for Clang - see arch/x86/entry/entry.S */
 PROVIDE(__ref_stack_chk_guard = __stack_chk_guard);
Signature · 1 line
2.45.2