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
8endif8endif
9export DISABLE_LATENT_ENTROPY_PLUGIN9export DISABLE_LATENT_ENTROPY_PLUGIN
10 10
11gcc-plugin-$(CONFIG_GCC_PLUGIN_STACKLEAK) += stackleak_plugin.so
12gcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_STACKLEAK) \
13 += -DSTACKLEAK_PLUGIN
14gcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_STACKLEAK) \
15 += -fplugin-arg-stackleak_plugin-track-min-size=$(CONFIG_KSTACK_ERASE_TRACK_MIN_SIZE)
16gcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_STACKLEAK) \
17 += -fplugin-arg-stackleak_plugin-arch=$(SRCARCH)
18gcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_STACKLEAK_VERBOSE) \
19 += -fplugin-arg-stackleak_plugin-verbose
20ifdef CONFIG_GCC_PLUGIN_STACKLEAK
21 DISABLE_KSTACK_ERASE += -fplugin-arg-stackleak_plugin-disable
22endif
23export DISABLE_KSTACK_ERASE
24
25# All the plugin CFLAGS are collected here in case a build target needs to11# All the plugin CFLAGS are collected here in case a build target needs to
26# filter them out of the KBUILD_CFLAGS.12# filter them out of the KBUILD_CFLAGS.
27GCC_PLUGINS_CFLAGS := $(strip $(addprefix -fplugin=$(objtree)/scripts/gcc-plugins/, $(gcc-plugin-y)) $(gcc-plugin-cflags-y)) -DGCC_PLUGINS13GCC_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
34# be included in GCC_PLUGIN so they can get built.20# be included in GCC_PLUGIN so they can get built.
35gcc-plugin-external-$(CONFIG_GCC_PLUGIN_RANDSTRUCT) \21gcc-plugin-external-$(CONFIG_GCC_PLUGIN_RANDSTRUCT) \
36 += randomize_layout_plugin.so22 += randomize_layout_plugin.so
23gcc-plugin-external-$(CONFIG_GCC_PLUGIN_STACKLEAK) \
24 += stackleak_plugin.so
37 25
38# All enabled GCC plugins are collected here for building in26# All enabled GCC plugins are collected here for building in
39# scripts/gcc-scripts/Makefile.27# scripts/gcc-scripts/Makefile.
scripts/Makefile.kstack_erase+15−0
@@ -0,0 +1,15 @@
1# SPDX-License-Identifier: GPL-2.0
2
3ifdef CONFIG_GCC_PLUGIN_STACKLEAK
4kstack-erase-cflags-y += -fplugin=$(objtree)/scripts/gcc-plugins/stackleak_plugin.so
5kstack-erase-cflags-y += -fplugin-arg-stackleak_plugin-track-min-size=$(CONFIG_KSTACK_ERASE_TRACK_MIN_SIZE)
6kstack-erase-cflags-y += -fplugin-arg-stackleak_plugin-arch=$(SRCARCH)
7kstack-erase-cflags-$(CONFIG_GCC_PLUGIN_STACKLEAK_VERBOSE) += -fplugin-arg-stackleak_plugin-verbose
8DISABLE_KSTACK_ERASE := -fplugin-arg-stackleak_plugin-disable
9endif
10
11KSTACK_ERASE_CFLAGS := $(kstack-erase-cflags-y)
12
13export STACKLEAK_CFLAGS DISABLE_KSTACK_ERASE
14
15KBUILD_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