aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--scripts/gcc-plugins/Kconfig51
-rw-r--r--security/Kconfig.hardening57
2 files changed, 57 insertions, 51 deletions
diff --git a/scripts/gcc-plugins/Kconfig b/scripts/gcc-plugins/Kconfig
index 352f03878a1e..80220ed26a35 100644
--- a/scripts/gcc-plugins/Kconfig
+++ b/scripts/gcc-plugins/Kconfig
@@ -108,57 +108,6 @@ config GCC_PLUGIN_RANDSTRUCT_PERFORMANCE
108 in structures. This reduces the performance hit of RANDSTRUCT 108 in structures. This reduces the performance hit of RANDSTRUCT
109 at the cost of weakened randomization. 109 at the cost of weakened randomization.
110 110
111config GCC_PLUGIN_STACKLEAK
112 bool "Erase the kernel stack before returning from syscalls"
113 depends on GCC_PLUGINS
114 depends on HAVE_ARCH_STACKLEAK
115 help
116 This option makes the kernel erase the kernel stack before
117 returning from system calls. That reduces the information which
118 kernel stack leak bugs can reveal and blocks some uninitialized
119 stack variable attacks.
120
121 The tradeoff is the performance impact: on a single CPU system kernel
122 compilation sees a 1% slowdown, other systems and workloads may vary
123 and you are advised to test this feature on your expected workload
124 before deploying it.
125
126 This plugin was ported from grsecurity/PaX. More information at:
127 * https://grsecurity.net/
128 * https://pax.grsecurity.net/
129
130config STACKLEAK_TRACK_MIN_SIZE
131 int "Minimum stack frame size of functions tracked by STACKLEAK"
132 default 100
133 range 0 4096
134 depends on GCC_PLUGIN_STACKLEAK
135 help
136 The STACKLEAK gcc plugin instruments the kernel code for tracking
137 the lowest border of the kernel stack (and for some other purposes).
138 It inserts the stackleak_track_stack() call for the functions with
139 a stack frame size greater than or equal to this parameter.
140 If unsure, leave the default value 100.
141
142config STACKLEAK_METRICS
143 bool "Show STACKLEAK metrics in the /proc file system"
144 depends on GCC_PLUGIN_STACKLEAK
145 depends on PROC_FS
146 help
147 If this is set, STACKLEAK metrics for every task are available in
148 the /proc file system. In particular, /proc/<pid>/stack_depth
149 shows the maximum kernel stack consumption for the current and
150 previous syscalls. Although this information is not precise, it
151 can be useful for estimating the STACKLEAK performance impact for
152 your workloads.
153
154config STACKLEAK_RUNTIME_DISABLE
155 bool "Allow runtime disabling of kernel stack erasing"
156 depends on GCC_PLUGIN_STACKLEAK
157 help
158 This option provides 'stack_erasing' sysctl, which can be used in
159 runtime to control kernel stack erasing for kernels built with
160 CONFIG_GCC_PLUGIN_STACKLEAK.
161
162config GCC_PLUGIN_ARM_SSP_PER_TASK 111config GCC_PLUGIN_ARM_SSP_PER_TASK
163 bool 112 bool
164 depends on GCC_PLUGINS && ARM 113 depends on GCC_PLUGINS && ARM
diff --git a/security/Kconfig.hardening b/security/Kconfig.hardening
index 19881341f1c2..a96d4a43ca65 100644
--- a/security/Kconfig.hardening
+++ b/security/Kconfig.hardening
@@ -88,6 +88,63 @@ config GCC_PLUGIN_STRUCTLEAK_VERBOSE
88 initialized. Since not all existing initializers are detected 88 initialized. Since not all existing initializers are detected
89 by the plugin, this can produce false positive warnings. 89 by the plugin, this can produce false positive warnings.
90 90
91config GCC_PLUGIN_STACKLEAK
92 bool "Poison kernel stack before returning from syscalls"
93 depends on GCC_PLUGINS
94 depends on HAVE_ARCH_STACKLEAK
95 help
96 This option makes the kernel erase the kernel stack before
97 returning from system calls. This has the effect of leaving
98 the stack initialized to the poison value, which both reduces
99 the lifetime of any sensitive stack contents and reduces
100 potential for uninitialized stack variable exploits or information
101 exposures (it does not cover functions reaching the same stack
102 depth as prior functions during the same syscall). This blocks
103 most uninitialized stack variable attacks, with the performance
104 impact being driven by the depth of the stack usage, rather than
105 the function calling complexity.
106
107 The performance impact on a single CPU system kernel compilation
108 sees a 1% slowdown, other systems and workloads may vary and you
109 are advised to test this feature on your expected workload before
110 deploying it.
111
112 This plugin was ported from grsecurity/PaX. More information at:
113 * https://grsecurity.net/
114 * https://pax.grsecurity.net/
115
116config STACKLEAK_TRACK_MIN_SIZE
117 int "Minimum stack frame size of functions tracked by STACKLEAK"
118 default 100
119 range 0 4096
120 depends on GCC_PLUGIN_STACKLEAK
121 help
122 The STACKLEAK gcc plugin instruments the kernel code for tracking
123 the lowest border of the kernel stack (and for some other purposes).
124 It inserts the stackleak_track_stack() call for the functions with
125 a stack frame size greater than or equal to this parameter.
126 If unsure, leave the default value 100.
127
128config STACKLEAK_METRICS
129 bool "Show STACKLEAK metrics in the /proc file system"
130 depends on GCC_PLUGIN_STACKLEAK
131 depends on PROC_FS
132 help
133 If this is set, STACKLEAK metrics for every task are available in
134 the /proc file system. In particular, /proc/<pid>/stack_depth
135 shows the maximum kernel stack consumption for the current and
136 previous syscalls. Although this information is not precise, it
137 can be useful for estimating the STACKLEAK performance impact for
138 your workloads.
139
140config STACKLEAK_RUNTIME_DISABLE
141 bool "Allow runtime disabling of kernel stack erasing"
142 depends on GCC_PLUGIN_STACKLEAK
143 help
144 This option provides 'stack_erasing' sysctl, which can be used in
145 runtime to control kernel stack erasing for kernels built with
146 CONFIG_GCC_PLUGIN_STACKLEAK.
147
91endmenu 148endmenu
92 149
93endmenu 150endmenu