From: Kees Cook <keescook@chromium.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Kees Cook <keescook@chromium.org>,
Daniel Micay <danielmicay@gmail.com>,
linux-kernel@vger.kernel.org
Subject: [PATCH 4/6] kexec_file: Adjust declaration of kexec_purgatory
Date: Mon, 5 Jun 2017 21:52:33 -0700 [thread overview]
Message-ID: <1496724755-104187-5-git-send-email-keescook@chromium.org> (raw)
In-Reply-To: <1496724755-104187-1-git-send-email-keescook@chromium.org>
Defining kexec_purgatory as a zero-length char array upsets compile
time size checking. Since this is built on a per-arch basis, define
it as an unsized char array (like is done for other similar things,
e.g. linker sections). This silences the warning generated by the future
CONFIG_FORTIFY_SOURCE, which did not like the memcmp() of a "0 byte"
array. This drops the __weak and uses an extern instead, since both
users define kexec_purgatory.
Cc: Daniel Micay <danielmicay@gmail.com>
Signed-off-by: Kees Cook <keescook@chromium.org>
Acked-by: "Eric W. Biederman" <ebiederm@xmission.com>
---
kernel/kexec_file.c | 7 -------
kernel/kexec_internal.h | 2 ++
2 files changed, 2 insertions(+), 7 deletions(-)
diff --git a/kernel/kexec_file.c b/kernel/kexec_file.c
index f78f719dae36..5710591a9b6d 100644
--- a/kernel/kexec_file.c
+++ b/kernel/kexec_file.c
@@ -26,13 +26,6 @@
#include <linux/vmalloc.h>
#include "kexec_internal.h"
-/*
- * Declare these symbols weak so that if architecture provides a purgatory,
- * these will be overridden.
- */
-char __weak kexec_purgatory[0];
-size_t __weak kexec_purgatory_size = 0;
-
static int kexec_calculate_store_digests(struct kimage *image);
/* Architectures can provide this probe function */
diff --git a/kernel/kexec_internal.h b/kernel/kexec_internal.h
index 799a8a452187..50dfcb039a41 100644
--- a/kernel/kexec_internal.h
+++ b/kernel/kexec_internal.h
@@ -17,6 +17,8 @@ extern struct mutex kexec_mutex;
#ifdef CONFIG_KEXEC_FILE
#include <linux/purgatory.h>
void kimage_file_post_load_cleanup(struct kimage *image);
+extern char kexec_purgatory[];
+extern size_t kexec_purgatory_size;
#else /* CONFIG_KEXEC_FILE */
static inline void kimage_file_post_load_cleanup(struct kimage *image) { }
#endif /* CONFIG_KEXEC_FILE */
--
2.7.4
next prev parent reply other threads:[~2017-06-06 4:53 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-06 4:52 [PATCH] FORTIFY_SOURCE build fixes Kees Cook
2017-06-06 4:52 ` [PATCH 1/6] arm64, vdso: Define vdso_{start,end} as array Kees Cook
2017-06-06 9:43 ` Catalin Marinas
2017-06-06 9:49 ` Will Deacon
2017-06-06 16:11 ` Kees Cook
2017-06-06 4:52 ` [PATCH 2/6] efi: Avoid fortify checks in EFI stub Kees Cook
2017-06-06 17:13 ` Ard Biesheuvel
2017-06-06 17:17 ` Mark Rutland
2017-06-07 3:12 ` Kees Cook
2017-06-07 8:54 ` Ard Biesheuvel
2017-06-08 2:37 ` Kees Cook
2017-06-09 9:01 ` Ard Biesheuvel
2017-06-16 9:14 ` Ard Biesheuvel
2017-06-07 9:27 ` Mark Rutland
2017-06-06 4:52 ` [PATCH 3/6] x86/power/64: Use char arrays for asm function names Kees Cook
2017-06-06 4:52 ` Kees Cook [this message]
2017-06-06 4:52 ` [PATCH 5/6] staging/rts5208: Fix read overflow in memcpy Kees Cook
2017-06-06 4:52 ` [PATCH 6/6] IB/rxe: Do not copy extra stack memory to skb 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=1496724755-104187-5-git-send-email-keescook@chromium.org \
--to=keescook@chromium.org \
--cc=akpm@linux-foundation.org \
--cc=danielmicay@gmail.com \
--cc=linux-kernel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®