History

stackleak: Split KSTACK_ERASE_CFLAGS from GCC_PLUGINS_CFLAGS

In preparation for Clang stack depth tracking for KSTACK_ERASE, split the stackleak-specific cflags out of GCC_PLUGINS_CFLAGS into KSTACK_ERASE_CFLAGS.

Kees Cook committed 1 year ago

Commit 76261fc1 parent 9ea1e8d8 files · +27 −18Browse files

Showing the changes to scripts (2 of 8 files). Show all

Unified · Split

2 files
  1. scripts/Makefile.gcc-plugins +2 −14
  2. scripts/Makefile.kstack_erase +15 −0
scripts/Makefile.gcc-plugins+2−14
@@ -8,20 +8,6 @@ ifdef CONFIG_GCC_PLUGIN_LATENT_ENTROPY · 7 unmodified lines
88 endif
99 export DISABLE_LATENT_ENTROPY_PLUGIN
1010
11−gcc-plugin-$(CONFIG_GCC_PLUGIN_STACKLEAK) += stackleak_plugin.so
12−gcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_STACKLEAK) \
13− += -DSTACKLEAK_PLUGIN
14−gcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_STACKLEAK) \
15− += -fplugin-arg-stackleak_plugin-track-min-size=$(CONFIG_KSTACK_ERASE_TRACK_MIN_SIZE)
16−gcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_STACKLEAK) \
17− += -fplugin-arg-stackleak_plugin-arch=$(SRCARCH)
18−gcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_STACKLEAK_VERBOSE) \
19− += -fplugin-arg-stackleak_plugin-verbose
20−ifdef CONFIG_GCC_PLUGIN_STACKLEAK
21− DISABLE_KSTACK_ERASE += -fplugin-arg-stackleak_plugin-disable
22−endif
23−export DISABLE_KSTACK_ERASE
24−
2511 # All the plugin CFLAGS are collected here in case a build target needs to
2612 # filter them out of the KBUILD_CFLAGS.
2713 GCC_PLUGINS_CFLAGS := $(strip $(addprefix -fplugin=$(objtree)/scripts/gcc-plugins/, $(gcc-plugin-y)) $(gcc-plugin-cflags-y)) -DGCC_PLUGINS
@@ -34,6 +20,8 @@ KBUILD_CFLAGS += $(GCC_PLUGINS_CFLAGS) · 6 unmodified lines
3420 # be included in GCC_PLUGIN so they can get built.
3521 gcc-plugin-external-$(CONFIG_GCC_PLUGIN_RANDSTRUCT) \
3622 += randomize_layout_plugin.so
23+gcc-plugin-external-$(CONFIG_GCC_PLUGIN_STACKLEAK) \
24+ += stackleak_plugin.so
3725
3826 # All enabled GCC plugins are collected here for building in
3927 # scripts/gcc-scripts/Makefile.
scripts/Makefile.kstack_erase+15−0
@@ -0,0 +1,15 @@
1+# SPDX-License-Identifier: GPL-2.0
2+
3+ifdef CONFIG_GCC_PLUGIN_STACKLEAK
4+kstack-erase-cflags-y += -fplugin=$(objtree)/scripts/gcc-plugins/stackleak_plugin.so
5+kstack-erase-cflags-y += -fplugin-arg-stackleak_plugin-track-min-size=$(CONFIG_KSTACK_ERASE_TRACK_MIN_SIZE)
6+kstack-erase-cflags-y += -fplugin-arg-stackleak_plugin-arch=$(SRCARCH)
7+kstack-erase-cflags-$(CONFIG_GCC_PLUGIN_STACKLEAK_VERBOSE) += -fplugin-arg-stackleak_plugin-verbose
8+DISABLE_KSTACK_ERASE := -fplugin-arg-stackleak_plugin-disable
9+endif
10+
11+KSTACK_ERASE_CFLAGS := $(kstack-erase-cflags-y)
12+
13+export STACKLEAK_CFLAGS DISABLE_KSTACK_ERASE
14+
15+KBUILD_CFLAGS += $(KSTACK_ERASE_CFLAGS)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t