From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754115AbdEJUP1 (ORCPT ); Wed, 10 May 2017 16:15:27 -0400 Received: from out02.mta.xmission.com ([166.70.13.232]:51155 "EHLO out02.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753485AbdEJUP0 (ORCPT ); Wed, 10 May 2017 16:15:26 -0400 From: ebiederm@xmission.com (Eric W. Biederman) To: Kees Cook Cc: kexec@lists.infradead.org, Daniel Micay , linux-kernel@vger.kernel.org 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> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-XM-SPF: eid=1d8Y11-0007QD-Ph;;;mid=<878tm4pj8k.fsf@xmission.com>;;;hst=in01.mta.xmission.com;;;ip=97.121.81.159;;;frm=ebiederm@xmission.com;;;spf=neutral X-XM-AID: U2FsdGVkX18lD1iDUbV6xqrY4cLln4TtnCl9z0OS9qo= X-SA-Exim-Connect-IP: 97.121.81.159 X-SA-Exim-Mail-From: ebiederm@xmission.com X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * 0.7 XMSubLong Long Subject * 0.0 TVD_RCVD_IP Message was received from an IP address * 0.0 T_TM2_M_HEADER_IN_MSG BODY: No description available. * 0.8 BAYES_50 BODY: Bayes spam probability is 40 to 60% * [score: 0.5000] * -0.0 DCC_CHECK_NEGATIVE Not listed in DCC * [sa08 1397; Body=1 Fuz1=1 Fuz2=1] X-Spam-DCC: XMission; sa08 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: ;Kees Cook X-Spam-Relay-Country: X-Spam-Timing: total 5676 ms - load_scoreonly_sql: 0.03 (0.0%), signal_user_changed: 2.8 (0.0%), b_tie_ro: 2.0 (0.0%), parse: 0.55 (0.0%), extract_message_metadata: 11 (0.2%), get_uri_detail_list: 1.05 (0.0%), tests_pri_-1000: 5.0 (0.1%), tests_pri_-950: 0.87 (0.0%), tests_pri_-900: 0.72 (0.0%), tests_pri_-400: 18 (0.3%), check_bayes: 17 (0.3%), b_tokenize: 4.5 (0.1%), b_tok_get_all: 6 (0.1%), b_comp_prob: 1.41 (0.0%), b_tok_touch_all: 3.4 (0.1%), b_finish: 0.66 (0.0%), tests_pri_0: 109 (1.9%), check_dkim_signature: 0.36 (0.0%), check_dkim_adsp: 2.3 (0.0%), tests_pri_500: 5526 (97.4%), poll_dns_idle: 5522 (97.3%), rewrite_mail: 0.00 (0.0%) Subject: Re: [PATCH v2] kexec_file: Adjust declaration of kexec_purgatory X-Spam-Flag: No X-SA-Exim-Version: 4.2.1 (built Thu, 05 May 2016 13:38:54 -0600) X-SA-Exim-Scanned: Yes (on in01.mta.xmission.com) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: 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