From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from out02.mta.xmission.com ([166.70.13.232]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1d8Y1T-0000L7-90 for kexec@lists.infradead.org; Wed, 10 May 2017 20:15:48 +0000 From: ebiederm@xmission.com (Eric W. Biederman) References: <20170510200205.GA8965@beast> Date: Wed, 10 May 2017 15:08:59 -0500 In-Reply-To: <20170510200205.GA8965@beast> (Kees Cook's message of "Wed, 10 May 2017 13:02:05 -0700") Message-ID: <878tm4pj8k.fsf@xmission.com> MIME-Version: 1.0 Subject: Re: [PATCH v2] kexec_file: Adjust declaration of kexec_purgatory List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "kexec" Errors-To: kexec-bounces+dwmw2=infradead.org@lists.infradead.org To: Kees Cook Cc: Daniel Micay , kexec@lists.infradead.org, linux-kernel@vger.kernel.org Kees Cook 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" > Cc: Daniel Micay > Signed-off-by: Kees Cook > --- > 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 > #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 > 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 _______________________________________________ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec