From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from mail-io0-x244.google.com ([2607:f8b0:4001:c06::244]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1d8EKY-0005w7-Hn for kexec@lists.infradead.org; Tue, 09 May 2017 23:14:12 +0000 Received: by mail-io0-x244.google.com with SMTP id 12so563878iol.1 for ; Tue, 09 May 2017 16:13:48 -0700 (PDT) Message-ID: <1494371625.7678.3.camel@gmail.com> Subject: Re: [PATCH] kexec_file: Adjust type of kexec_purgatory From: Daniel Micay Date: Tue, 09 May 2017 19:13:45 -0400 In-Reply-To: <20170509230639.GA132135@beast> References: <20170509230639.GA132135@beast> Mime-Version: 1.0 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 , linux-kernel@vger.kernel.org Cc: kexec@lists.infradead.org, Eric Biederman On Tue, 2017-05-09 at 16:06 -0700, Kees Cook wrote: > Defining kexec_purgatory as a zero-length char array upsets compile > time size checking. Since this is entirely runtime sized, switch > this to void *. This silences the warning generated by the future > CONFIG_FORTIFY_SOURCE, which did not like the memcmp() of a "0 byte" > array. > > Cc: Daniel Micay > Signed-off-by: Kees Cook > --- > kernel/kexec_file.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/kernel/kexec_file.c b/kernel/kexec_file.c > index b118735fea9d..bc86f85f1329 100644 > --- a/kernel/kexec_file.c > +++ b/kernel/kexec_file.c > @@ -30,7 +30,7 @@ > * Declare these symbols weak so that if architecture provides a > purgatory, > * these will be overridden. > */ > -char __weak kexec_purgatory[0]; > +void * __weak kexec_purgatory; > size_t __weak kexec_purgatory_size = 0; > > static int kexec_calculate_store_digests(struct kimage *image); > -- > 2.7.4 It seems more correct to use char `char __weak kexec_purgatory[]`, otherwise isn't __builtin_object_size ending up as 8, which is still wrong? _______________________________________________ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750984AbdEIXNu (ORCPT ); Tue, 9 May 2017 19:13:50 -0400 Received: from mail-io0-f196.google.com ([209.85.223.196]:33582 "EHLO mail-io0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750734AbdEIXNs (ORCPT ); Tue, 9 May 2017 19:13:48 -0400 Message-ID: <1494371625.7678.3.camel@gmail.com> Subject: Re: [PATCH] kexec_file: Adjust type of kexec_purgatory From: Daniel Micay To: Kees Cook , linux-kernel@vger.kernel.org Cc: Eric Biederman , kexec@lists.infradead.org Date: Tue, 09 May 2017 19:13:45 -0400 In-Reply-To: <20170509230639.GA132135@beast> References: <20170509230639.GA132135@beast> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.24.2 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 2017-05-09 at 16:06 -0700, Kees Cook wrote: > Defining kexec_purgatory as a zero-length char array upsets compile > time size checking. Since this is entirely runtime sized, switch > this to void *. This silences the warning generated by the future > CONFIG_FORTIFY_SOURCE, which did not like the memcmp() of a "0 byte" > array. > > Cc: Daniel Micay > Signed-off-by: Kees Cook > --- > kernel/kexec_file.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/kernel/kexec_file.c b/kernel/kexec_file.c > index b118735fea9d..bc86f85f1329 100644 > --- a/kernel/kexec_file.c > +++ b/kernel/kexec_file.c > @@ -30,7 +30,7 @@ > * Declare these symbols weak so that if architecture provides a > purgatory, > * these will be overridden. > */ > -char __weak kexec_purgatory[0]; > +void * __weak kexec_purgatory; > size_t __weak kexec_purgatory_size = 0; > > static int kexec_calculate_store_digests(struct kimage *image); > -- > 2.7.4 It seems more correct to use char `char __weak kexec_purgatory[]`, otherwise isn't __builtin_object_size ending up as 8, which is still wrong?