[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250417123627.2223800-1-linux@roeck-us.net>
Date: Thu, 17 Apr 2025 05:36:27 -0700
From: Guenter Roeck <linux@...ck-us.net>
To: x86@...nel.org
Cc: Andrey Ryabinin <ryabinin.a.a@...il.com>,
Alexander Potapenko <glider@...gle.com>,
Andrey Konovalov <andreyknvl@...il.com>,
Dmitry Vyukov <dvyukov@...gle.com>,
Vincenzo Frascino <vincenzo.frascino@....com>,
Andrew Morton <akpm@...ux-foundation.org>,
kasan-dev@...glegroups.com,
linux-kernel@...r.kernel.org,
"H . Peter Anvin" <hpa@...or.com>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>,
Borislav Petkov <bp@...en8.de>,
Dave Hansen <dave.hansen@...ux.intel.com>,
Guenter Roeck <linux@...ck-us.net>,
Linus Torvalds <torvalds@...ux-foundation.org>
Subject: [PATCH v4] 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.
While at it, fix typo in associated comment (sink -> sync).
Fixes: 6f110a5e4f99 ("Disable SLUB_TINY for build testing")
Suggested-by: Andrew Morton <akpm@...ux-foundation.org>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>
Signed-off-by: Guenter Roeck <linux@...ck-us.net>
---
v4: Added comment explaining the change
Fixed sink -> sync comment
(both thanks to Andrew).
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/20250416230559.2017012-1-linux@roeck-us.net/
Link to RFC:
https://lore.kernel.org/lkml/20250414011345.2602656-1-linux@roeck-us.net/
arch/x86/kernel/vmlinux.lds.S | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/arch/x86/kernel/vmlinux.lds.S b/arch/x86/kernel/vmlinux.lds.S
index ccdc45e5b759..453f5b5e4817 100644
--- a/arch/x86/kernel/vmlinux.lds.S
+++ b/arch/x86/kernel/vmlinux.lds.S
@@ -466,10 +466,18 @@ SECTIONS
}
/*
- * The ASSERT() sink to . is intentional, for binutils 2.14 compatibility:
+ * COMPILE_TEST kernels can be large - CONFIG_KASAN, for example, can cause
+ * this. Let's assume that nobody will be running a COMPILE_TEST kernel and
+ * let's assert that fuller build coverage is more valuable than being able to
+ * run a COMPILE_TEST kernel.
+ */
+#ifndef CONFIG_COMPILE_TEST
+/*
+ * The ASSERT() sync to . is intentional, for binutils 2.14 compatibility:
*/
. = 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);
--
2.45.2
Powered by blists - more mailing lists