Kexec Archive on lore.kernel.org
 help / color / mirror / Atom feed
* PATCH: kexec/i386: fix erroneous memory descriptor message
@ 2014-03-27  4:54 Tony Jones
  2014-03-27  5:47 ` Dave Young
  0 siblings, 1 reply; 3+ messages in thread
From: Tony Jones @ 2014-03-27  4:54 UTC (permalink / raw)
  To: kexec; +Cc: Simon Horman, dyoung

On non-EFI systems, efi_info section of boot_params is zero filled resulting 
in an erroneous message from kexec regarding "efi memory descriptor" version.

Caused by commit: e1ffc9e9a0769e1f54185003102e9bec428b84e8 "Passing efi related 
data via setup_data"

# od -j 448 -N 32 -v -x /sys/kernel/boot_params/data 
0000700 0000 0000 0000 0000 0000 0000 0000 0000
0000720 0000 0000 0000 0000 0000 0000 0000 0000
0000740

# kexec -l --reuse-cmdline --initrd=/boot/initrd-`uname -r` /boot/vmlinuz-`uname -r`
efi memory descriptor version 0 is not supported!

Signed-off-by: Tony Jones <tonyj@suse.de>

---
 kexec/arch/i386/x86-linux-setup.c |   14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

--- a/kexec/arch/i386/x86-linux-setup.c
+++ b/kexec/arch/i386/x86-linux-setup.c
@@ -687,17 +687,25 @@ static void setup_efi_info(struct kexec_
 	ret = get_bootparam(&real_mode->efi_info, offset, 32);
 	if (ret)
 		return;
+	if (((struct efi_info *)real_mode->efi_info)->efi_memmap_size == 0)
+		/* zero filled efi_info */
+		goto out;
 	desc_version = get_efi_mem_desc_version(real_mode);
 	if (desc_version != 1) {
 		fprintf(stderr,
 			"efi memory descriptor version %d is not supported!\n",
 			desc_version);
-		memset(&real_mode->efi_info, 0, 32);
-		return;
+		goto out;
 	}
 	ret = setup_efi_data(info, real_mode);
 	if (ret)
-		memset(&real_mode->efi_info, 0, 32);
+		goto out;
+
+	return;
+
+out:
+	memset(&real_mode->efi_info, 0, 32);
+	return;
 }
 
 void setup_linux_system_parameters(struct kexec_info *info,

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: PATCH: kexec/i386: fix erroneous memory descriptor message
  2014-03-27  4:54 PATCH: kexec/i386: fix erroneous memory descriptor message Tony Jones
@ 2014-03-27  5:47 ` Dave Young
  2014-03-28 16:44   ` Simon Horman
  0 siblings, 1 reply; 3+ messages in thread
From: Dave Young @ 2014-03-27  5:47 UTC (permalink / raw)
  To: Tony Jones; +Cc: Simon Horman, kexec

On 03/26/14 at 09:54pm, Tony Jones wrote:
> On non-EFI systems, efi_info section of boot_params is zero filled resulting 
> in an erroneous message from kexec regarding "efi memory descriptor" version.
> 
> Caused by commit: e1ffc9e9a0769e1f54185003102e9bec428b84e8 "Passing efi related 
> data via setup_data"
> 
> # od -j 448 -N 32 -v -x /sys/kernel/boot_params/data 
> 0000700 0000 0000 0000 0000 0000 0000 0000 0000
> 0000720 0000 0000 0000 0000 0000 0000 0000 0000
> 0000740
> 
> # kexec -l --reuse-cmdline --initrd=/boot/initrd-`uname -r` /boot/vmlinuz-`uname -r`
> efi memory descriptor version 0 is not supported!
> 
> Signed-off-by: Tony Jones <tonyj@suse.de>
> 
> ---
>  kexec/arch/i386/x86-linux-setup.c |   14 +++++++++++---
>  1 file changed, 11 insertions(+), 3 deletions(-)
> 
> --- a/kexec/arch/i386/x86-linux-setup.c
> +++ b/kexec/arch/i386/x86-linux-setup.c
> @@ -687,17 +687,25 @@ static void setup_efi_info(struct kexec_
>  	ret = get_bootparam(&real_mode->efi_info, offset, 32);
>  	if (ret)
>  		return;
> +	if (((struct efi_info *)real_mode->efi_info)->efi_memmap_size == 0)
> +		/* zero filled efi_info */
> +		goto out;
>  	desc_version = get_efi_mem_desc_version(real_mode);
>  	if (desc_version != 1) {
>  		fprintf(stderr,
>  			"efi memory descriptor version %d is not supported!\n",
>  			desc_version);
> -		memset(&real_mode->efi_info, 0, 32);
> -		return;
> +		goto out;
>  	}
>  	ret = setup_efi_data(info, real_mode);
>  	if (ret)
> -		memset(&real_mode->efi_info, 0, 32);
> +		goto out;
> +
> +	return;
> +
> +out:
> +	memset(&real_mode->efi_info, 0, 32);
> +	return;
>  }
>  
>  void setup_linux_system_parameters(struct kexec_info *info,

Good catch, thanks.

Acked-by: Dave Young <dyoung@redhat.com>

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: PATCH: kexec/i386: fix erroneous memory descriptor message
  2014-03-27  5:47 ` Dave Young
@ 2014-03-28 16:44   ` Simon Horman
  0 siblings, 0 replies; 3+ messages in thread
From: Simon Horman @ 2014-03-28 16:44 UTC (permalink / raw)
  To: Dave Young; +Cc: kexec, Tony Jones

On Thu, Mar 27, 2014 at 01:47:15PM +0800, Dave Young wrote:
> On 03/26/14 at 09:54pm, Tony Jones wrote:
> > On non-EFI systems, efi_info section of boot_params is zero filled resulting 
> > in an erroneous message from kexec regarding "efi memory descriptor" version.
> > 
> > Caused by commit: e1ffc9e9a0769e1f54185003102e9bec428b84e8 "Passing efi related 
> > data via setup_data"
> > 
> > # od -j 448 -N 32 -v -x /sys/kernel/boot_params/data 
> > 0000700 0000 0000 0000 0000 0000 0000 0000 0000
> > 0000720 0000 0000 0000 0000 0000 0000 0000 0000
> > 0000740
> > 
> > # kexec -l --reuse-cmdline --initrd=/boot/initrd-`uname -r` /boot/vmlinuz-`uname -r`
> > efi memory descriptor version 0 is not supported!
> > 
> > Signed-off-by: Tony Jones <tonyj@suse.de>
> > 
> > ---
> >  kexec/arch/i386/x86-linux-setup.c |   14 +++++++++++---
> >  1 file changed, 11 insertions(+), 3 deletions(-)
> > 
> > --- a/kexec/arch/i386/x86-linux-setup.c
> > +++ b/kexec/arch/i386/x86-linux-setup.c
> > @@ -687,17 +687,25 @@ static void setup_efi_info(struct kexec_
> >  	ret = get_bootparam(&real_mode->efi_info, offset, 32);
> >  	if (ret)
> >  		return;
> > +	if (((struct efi_info *)real_mode->efi_info)->efi_memmap_size == 0)
> > +		/* zero filled efi_info */
> > +		goto out;
> >  	desc_version = get_efi_mem_desc_version(real_mode);
> >  	if (desc_version != 1) {
> >  		fprintf(stderr,
> >  			"efi memory descriptor version %d is not supported!\n",
> >  			desc_version);
> > -		memset(&real_mode->efi_info, 0, 32);
> > -		return;
> > +		goto out;
> >  	}
> >  	ret = setup_efi_data(info, real_mode);
> >  	if (ret)
> > -		memset(&real_mode->efi_info, 0, 32);
> > +		goto out;
> > +
> > +	return;
> > +
> > +out:
> > +	memset(&real_mode->efi_info, 0, 32);
> > +	return;
> >  }
> >  
> >  void setup_linux_system_parameters(struct kexec_info *info,
> 
> Good catch, thanks.
> 
> Acked-by: Dave Young <dyoung@redhat.com>

Thanks, Applied.

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-03-28 16:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-27  4:54 PATCH: kexec/i386: fix erroneous memory descriptor message Tony Jones
2014-03-27  5:47 ` Dave Young
2014-03-28 16:44   ` Simon Horman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox