Skip to content

Commit de6bff8

Browse files
authored
Enabled hardening configs default to build. (#1223)
This PR introduces support for merging `hardening.config` into the kernel configuration for linux-qcom-next. The goal is to ensure that security hardening options are applied consistently across all builds. What’s Changed Added logic to include `hardening.config` during kernel configuration using merge_config.sh. Override `CONFIG_KSTACK_ERASE=n` Why This Change Kernel builds previously lacked default hardening options, which could lead to reduced security. This update ensures that compiler-based mitigations and other hardening features are applied by default. Override `CONFIG_KSTACK_ERASE=n` because enabling it introduces absolute workspace paths into out‑of‑tree (OOT) kernel module builds, which cause Yocto's package QA to flag this as build error. Verification verified build on QCS9100-ride-sx. Kernel configuration includes hardening options as expected. Ref: [1201#issuecomment-3543906617](#1201 (comment)) #1628 (comment)
2 parents 22261fd + 6aeb796 commit de6bff8

4 files changed

Lines changed: 6 additions & 2 deletions

File tree

recipes-kernel/linux/linux-qcom-6.18/configs/bsp-additions.cfg

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,3 +314,5 @@ CONFIG_NFT_TPROXY=m
314314
CONFIG_NFT_TUNNEL=m
315315
CONFIG_PACKET_DIAG=y
316316
CONFIG_VETH=m
317+
# Disable stack erase plugin to avoid buildpath leakage in out-of-tree modules
318+
CONFIG_KSTACK_ERASE=n

recipes-kernel/linux/linux-qcom-next/configs/bsp-additions.cfg

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,3 +314,5 @@ CONFIG_NFT_TPROXY=m
314314
CONFIG_NFT_TUNNEL=m
315315
CONFIG_PACKET_DIAG=y
316316
CONFIG_VETH=m
317+
# Disable stack erase plugin to avoid buildpath leakage in out-of-tree modules
318+
CONFIG_KSTACK_ERASE=n

recipes-kernel/linux/linux-qcom-next_git.bb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ S = "${UNPACKDIR}/${BP}"
3636
KBUILD_DEFCONFIG ?= "defconfig"
3737
KBUILD_DEFCONFIG:qcom-armv7a = "qcom_defconfig"
3838

39-
KBUILD_CONFIG_EXTRA = "${@bb.utils.contains('DISTRO_FEATURES', 'hardened', '${S}/kernel/configs/hardening.config', '', d)}"
39+
KBUILD_CONFIG_EXTRA = "${S}/kernel/configs/hardening.config"
4040
KBUILD_CONFIG_EXTRA:append:aarch64 = " ${S}/arch/arm64/configs/prune.config"
4141
KBUILD_CONFIG_EXTRA:append:aarch64 = " ${S}/arch/arm64/configs/qcom.config"
4242
KBUILD_CONFIG_EXTRA:append = " ${@oe.utils.vartrue('DEBUG_BUILD', '${S}/kernel/configs/debug.config', '', d)}"

recipes-kernel/linux/linux-qcom_6.18.bb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ S = "${UNPACKDIR}/${BP}"
3939
KBUILD_DEFCONFIG ?= "defconfig"
4040
KBUILD_DEFCONFIG:qcom-armv7a = "qcom_defconfig"
4141

42-
KBUILD_CONFIG_EXTRA = "${@bb.utils.contains('DISTRO_FEATURES', 'hardened', '${S}/kernel/configs/hardening.config', '', d)}"
42+
KBUILD_CONFIG_EXTRA = "${S}/kernel/configs/hardening.config"
4343
KBUILD_CONFIG_EXTRA:append:aarch64 = " ${S}/arch/arm64/configs/prune.config"
4444
KBUILD_CONFIG_EXTRA:append:aarch64 = " ${S}/arch/arm64/configs/qcom.config"
4545
KBUILD_CONFIG_EXTRA:append = " ${@oe.utils.vartrue('DEBUG_BUILD', '${S}/kernel/configs/debug.config', '', d)}"

0 commit comments

Comments
 (0)