mirror of
https://gitlab.com/buildroot.org/buildroot.git
synced 2026-09-09 16:01:54 -09:00
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/<module>.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]e811f51549[3]90413f6657[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.patch77fb841f2eCc: Thomas Petazzoni <thomas.petazzoni@bootlin.com> Signed-off-by: Romain Naour <romain.naour@smile.fr> Signed-off-by: Julien Olivain <ju.o@free.fr>
This commit is contained in:
committed by
Julien Olivain
parent
45636d67c9
commit
32b4f3f942
@@ -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),
|
||||
|
||||
Reference in New Issue
Block a user