From: ebiederm@xmission.com (Eric W. Biederman)
To: Kees Cook <keescook@chromium.org>
Cc: kexec@lists.infradead.org, Daniel Micay <danielmicay@gmail.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] kexec_file: Adjust declaration of kexec_purgatory
Date: Wed, 10 May 2017 15:08:59 -0500 [thread overview]
Message-ID: <878tm4pj8k.fsf@xmission.com> (raw)
In-Reply-To: <20170510200205.GA8965@beast> (Kees Cook's message of "Wed, 10 May 2017 13:02:05 -0700")
Kees Cook <keescook@chromium.org> writes:
> 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.
Acked-by: "Eric W. Biederman" <ebiederm@xmission.com>
> Cc: Daniel Micay <danielmicay@gmail.com>
> Signed-off-by: Kees Cook <keescook@chromium.org>
> ---
> v2: use extern instead of __weak void *; ebiederm
> ---
> 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 b118735fea9d..7a147a7add2e 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
prev parent reply other threads:[~2017-05-10 20:15 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-10 20:02 [PATCH v2] kexec_file: Adjust declaration of kexec_purgatory Kees Cook
2017-05-10 20:08 ` Eric W. Biederman [this message]
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=878tm4pj8k.fsf@xmission.com \
--to=ebiederm@xmission.com \
--cc=danielmicay@gmail.com \
--cc=keescook@chromium.org \
--cc=kexec@lists.infradead.org \
--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