mirror of
https://github.com/torvalds/linux.git
synced 2026-10-22 23:01:49 +02:00
With GCC plugins enabled, external module builds can record -fplugin=... paths in DWARF producer metadata via -grecord-gcc-switches, leaking host/build specific paths and triggering QA checks. Handle this in scripts/Makefile.gcc-plugins for KBUILD_EXTMOD builds by adding -gno-record-gcc-switches to plugin cflags. This keeps plugin behavior unchanged while avoiding absolute plugin path leakage in external module debug metadata. Suggested-by: Nathan Chancellor <nathan@kernel.org> Link: https://lore.kernel.org/all/20260817185146.GC1249844@ax162/ Signed-off-by: Jaihind Yadav <jaihindy@qti.qualcomm.com> Link: https://patch.msgid.link/20260820060116.786173-1-jaihindy@qti.qualcomm.com Signed-off-by: Nathan Chancellor <nathan@kernel.org>
34 lines
1.4 KiB
Makefile
34 lines
1.4 KiB
Makefile
# SPDX-License-Identifier: GPL-2.0
|
|
|
|
gcc-plugin-$(CONFIG_GCC_PLUGIN_LATENT_ENTROPY) += latent_entropy_plugin.so
|
|
gcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_LATENT_ENTROPY) \
|
|
+= -DLATENT_ENTROPY_PLUGIN
|
|
ifdef CONFIG_GCC_PLUGIN_LATENT_ENTROPY
|
|
DISABLE_LATENT_ENTROPY_PLUGIN += -fplugin-arg-latent_entropy_plugin-disable -ULATENT_ENTROPY_PLUGIN
|
|
endif
|
|
export DISABLE_LATENT_ENTROPY_PLUGIN
|
|
|
|
# Disable recording GCC options in debug info when building external modules to
|
|
# avoid leaking absolute host build paths
|
|
gcc-plugin-cflags-$(if $(KBUILD_EXTMOD),y) += -gno-record-gcc-switches
|
|
|
|
# All the plugin CFLAGS are collected here in case a build target needs to
|
|
# filter them out of the KBUILD_CFLAGS.
|
|
GCC_PLUGINS_CFLAGS := $(strip $(addprefix -fplugin=$(objtree)/scripts/gcc-plugins/, $(gcc-plugin-y)) $(gcc-plugin-cflags-y)) -DGCC_PLUGINS
|
|
export GCC_PLUGINS_CFLAGS
|
|
|
|
# Add the flags to the build!
|
|
KBUILD_CFLAGS += $(GCC_PLUGINS_CFLAGS)
|
|
|
|
# Some plugins are enabled outside of this Makefile, but they still need to
|
|
# be included in GCC_PLUGIN so they can get built.
|
|
gcc-plugin-external-$(CONFIG_GCC_PLUGIN_RANDSTRUCT) \
|
|
+= randomize_layout_plugin.so
|
|
gcc-plugin-external-$(CONFIG_GCC_PLUGIN_STACKLEAK) \
|
|
+= stackleak_plugin.so
|
|
|
|
# All enabled GCC plugins are collected here for building in
|
|
# scripts/gcc-scripts/Makefile.
|
|
GCC_PLUGIN := $(gcc-plugin-y) $(gcc-plugin-external-y)
|
|
export GCC_PLUGIN
|