From 32b4f3f942a26476da9533cb11afdeb5a27861ba Mon Sep 17 00:00:00 2001 From: Romain Naour Date: Thu, 27 Aug 2026 23:21:23 +0200 Subject: [PATCH] linux: disable SSP support when needed x86 and x86_64 kernels >= 6.15 now requires ssp toolchain support when CONFIG_STACKPROTECTOR is enabled [1]. For toolchains without SSP support, make sure to disable CONFIG_STACKPROTECTOR to avoid link issues when building kernel modules. MODPOST Module.symvers ERROR: modpost: "__stack_chk_guard" [drivers/.ko] undefined! While the SSP support is mandatory for glibc and musl based toolchains [2], it's still optional for uClibc-ng based toolchains and not enabled by default when building a new toolchain. The Toolchain builder project enabled recently the SSP support for all uClibc toolchains [3] to avoid such issue. But x86 (32bits) musl based toolchains lack of SSP support due to a long term gcc issue [4]. For a decade Alpine Linux, OpenWRT and Yocto povide additional gcc and musl patches to workaround the gcc issue [5] We may consider in the long term removing the support for toolchains without SSP and doing so removing x86 (32bits) musl toolchain. Fixes: https://gitlab.com/buildroot.org/toolchains-builder/-/jobs/15832356731 (x86-64--uclibc--bleeding-edge_test) https://gitlab.com/buildroot.org/toolchains-builder/-/jobs/15832356104 (x86-64--uclibc--stable_test) https://gitlab.com/buildroot.org/toolchains-builder/-/jobs/15832355429 (x86-64-core-i7--uclibc--bleeding-edge_test) https://gitlab.com/buildroot.org/toolchains-builder/-/jobs/15832354341 (x86-64-core-i7--uclibc--stable_test) https://gitlab.com/buildroot.org/toolchains-builder/-/jobs/15832326525 (x86-64-v2--uclibc--bleeding-edge_test) https://gitlab.com/buildroot.org/toolchains-builder/-/jobs/15832316220 (x86-64-v2--uclibc--stable_test) https://gitlab.com/buildroot.org/toolchains-builder/-/jobs/15819139512 (x86-i686--uclibc--stable_test) https://gitlab.com/buildroot.org/toolchains-builder/-/jobs/15819139511 (x86-i686--uclibc--bleeding-edge_test) https://gitlab.com/buildroot.org/toolchains-builder/-/jobs/15819139510 (x86-i686--musl--stable_test) https://gitlab.com/buildroot.org/toolchains-builder/-/jobs/15819139509 (x86-i686--musl--bleeding-edge_test) https://gitlab.com/buildroot.org/toolchains-builder/-/jobs/15819139506 (x86-core2--uclibc--stable_test) https://gitlab.com/buildroot.org/toolchains-builder/-/jobs/15819139505 (x86-core2--uclibc--bleeding-edge_test) https://gitlab.com/buildroot.org/toolchains-builder/-/jobs/15819139504 (x86-core2--musl--stable_test) https://gitlab.com/buildroot.org/toolchains-builder/-/jobs/15819139503 (x86-core2--musl--bleeding-edge_test) [1] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=0ee2689b9374d6fd5f43b703713a53227 [2] e811f5154944147e4fceb8d199321aba91070587 [3] https://gitlab.com/buildroot.org/toolchains-builder/-/commit/90413f665735e1786cca2403cd1ff997920c99ae [4] https://www.openwall.com/lists/musl/2016/12/04/2 [5] https://git.alpinelinux.org/aports/tree/main/musl/APKBUILD#n65 https://git.alpinelinux.org/aports/tree/main/gcc/0018-Alpine-musl-package-provides-libssp_nonshared.a.-We-.patch https://github.com/openwrt/openwrt/blob/v25.12.5/toolchain/gcc/patches-15.x/230-musl_libssp.patch https://github.com/openwrt/openwrt/blob/v25.12.5/toolchain/musl/patches/200-add_libssp_nonshared.patch https://github.com/openembedded/openembedded-core/commit/77fb841f2e747dc7fb5e9234d870a7a32a74d09b Cc: Thomas Petazzoni Signed-off-by: Romain Naour Signed-off-by: Julien Olivain --- linux/linux.mk | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/linux/linux.mk b/linux/linux.mk index e790daff66..e3c89282fe 100644 --- a/linux/linux.mk +++ b/linux/linux.mk @@ -419,6 +419,17 @@ define LINUX_KCONFIG_FIXUP_CMDS_ROOTFS_CPIO endef endif +# Since kernel >= 6.15.y, x86 and x86_64 kernels requires a toolchain +# with SSP support when CONFIG_STACKPROTECTOR is enabled. +# For toolchains without SSP support, make sure to disable +# CONFIG_STACKPROTECTOR to avoid link issues when building kernel +# modules. +ifeq ($(BR2_i386)$(BR2_x86_64):$(BR2_TOOLCHAIN_HAS_SSP),y:) +define LINUX_FIXUP_CONFIG_STACKPROTECTOR + $(call KCONFIG_DISABLE_OPT,CONFIG_STACKPROTECTOR) +endef +endif + define LINUX_KCONFIG_FIXUP_CMDS @$(call MESSAGE,"Updating kernel config with fixups") $(if $(LINUX_NEEDS_MODULES), @@ -429,6 +440,7 @@ define LINUX_KCONFIG_FIXUP_CMDS ) $(LINUX_FIXUP_CONFIG_ENDIANNESS) $(LINUX_FIXUP_CONFIG_PAHOLE_CHECK) + $(LINUX_FIXUP_CONFIG_STACKPROTECTOR) $(if $(BR2_arm)$(BR2_armeb), $(call KCONFIG_ENABLE_OPT,CONFIG_AEABI)) $(if $(BR2_powerpc)$(BR2_powerpc64)$(BR2_powerpc64le),