From: P J P <ppandit@redhat.com>
To: kernel-hardening@lists.openwall.com
Cc: Florian Weimer <fweimer@redhat.com>, P J P <pjp@fedoraproject.org>
Subject: [PATCH 1/1] Add an option to build kernel with -finit-local-vars
Date: Tue, 27 Feb 2018 16:45:32 +0530 [thread overview]
Message-ID: <20180227111532.1144-2-ppandit@redhat.com> (raw)
In-Reply-To: <20180227111532.1144-1-ppandit@redhat.com>
From: P J P <pjp@fedoraproject.org>
Add a configuration option to build kernel with -finit-local-vars
compiler option.[*] It'll zero initialize the automatic kernel
function variables, thus helping to reduce kernel information
leakage issues.
[*] https://gcc.gnu.org/ml/gcc-patches/2014-06/msg00615.html
Signed-off-by: P J P <pjp@fedoraproject.org>
---
Makefile | 4 ++++
lib/Kconfig.debug | 8 ++++++++
2 files changed, 12 insertions(+)
diff --git a/Makefile b/Makefile
index 659a7780aeb3..7b25a77470ca 100644
--- a/Makefile
+++ b/Makefile
@@ -781,6 +781,10 @@ KBUILD_CFLAGS += $(call cc-option, -femit-struct-debug-baseonly) \
$(call cc-option,-fno-var-tracking)
endif
+ifdef CONFIG_FINIT_LOCAL_VARS
+KBUILD_CFLAGS += $(call cc-option, -finit-local-vars)
+endif
+
ifdef CONFIG_FUNCTION_TRACER
ifndef CC_FLAGS_FTRACE
CC_FLAGS_FTRACE := -pg
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index 64155e310a9f..8da18d145c5b 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -206,6 +206,14 @@ config ENABLE_WARN_DEPRECATED
Disable this to suppress the "warning: 'foo' is deprecated
(declared at kernel/power/somefile.c:1234)" messages.
+config FINIT_LOCAL_VARS
+ bool "Enable -finit-local-vars"
+ default n
+ help
+ Enable the -finit-local-vars compiler option during the kernel build.
+ It'll zero initialise the automatic kernel function variables, thus
+ helping to reduce kernel information leakage issues.
+
config ENABLE_MUST_CHECK
bool "Enable __must_check logic"
default y
--
2.14.3
next prev parent reply other threads:[~2018-02-27 11:15 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-27 11:15 [PATCH 0/1] Zero initialise kernel stack variables P J P
2018-02-27 11:15 ` P J P [this message]
2018-02-27 19:22 ` [PATCH 1/1] Add an option to build kernel with -finit-local-vars Laura Abbott
2018-02-27 19:33 ` Kees Cook
2018-02-28 5:49 ` P J P
2018-02-27 19:28 ` [PATCH 0/1] Zero initialise kernel stack variables Kees Cook
2018-02-27 23:26 ` Laura Abbott
2018-02-27 23:38 ` Kees Cook
2018-02-28 6:22 ` P J P
2018-02-28 8:25 ` Florian Weimer
2018-02-28 6:04 ` P J P
2018-03-02 19:52 ` Nick Kralevich
2018-03-02 21:01 ` Casey Schaufler
2018-03-05 20:42 ` Kees Cook
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180227111532.1144-2-ppandit@redhat.com \
--to=ppandit@redhat.com \
--cc=fweimer@redhat.com \
--cc=kernel-hardening@lists.openwall.com \
--cc=pjp@fedoraproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.