linux-efi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] efi/x86: Revert struct layout change to fix kexec boot regression
@ 2020-04-10  7:43 Ard Biesheuvel
  2020-04-10 13:56 ` Dave Young
  0 siblings, 1 reply; 7+ messages in thread
From: Ard Biesheuvel @ 2020-04-10  7:43 UTC (permalink / raw)
  To: linux-efi; +Cc: x86, tytso, bp, mingo, Ard Biesheuvel

Commit

  0a67361dcdaa29 ("efi/x86: Remove runtime table address from kexec EFI setup data")

removed the code that retrieves the non-remapped UEFI runtime services
pointer from the data structure provided by kexec, as it was never really
needed on the kexec boot path: mapping the runtime services table at its
non-remapped address is only needed when calling SetVirtualAddressMap(),
which never happens during a kexec boot in the first place.

However, dropping the 'runtime' member from struct efi_setup_data was a
mistake. That struct is shared ABI between the kernel and the kexec tooling
for x86, and so we cannot simply change its layout. So let's put back the
removed field, but call it 'unused' to reflect the fact that we never look
at its contents. While at it, add a comment to remind our future selves
that the layout is external ABI.

Reported-by: Theodore Ts'o <tytso@mit.edu>
Tested-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
---

Ingo, Thomas, Boris: I sent out my efi-urgent pull request just yesterday,
so please take this directly into tip:efi/urgent - no need to wait for the
next batch.

 arch/x86/include/asm/efi.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/x86/include/asm/efi.h b/arch/x86/include/asm/efi.h
index 781170d36f50..96044c8d8600 100644
--- a/arch/x86/include/asm/efi.h
+++ b/arch/x86/include/asm/efi.h
@@ -178,8 +178,10 @@ extern void efi_free_boot_services(void);
 extern pgd_t * __init efi_uv1_memmap_phys_prolog(void);
 extern void __init efi_uv1_memmap_phys_epilog(pgd_t *save_pgd);
 
+/* kexec external ABI */
 struct efi_setup_data {
 	u64 fw_vendor;
+	u64 unused;
 	u64 tables;
 	u64 smbios;
 	u64 reserved[8];
-- 
2.17.1


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

* Re: [PATCH] efi/x86: Revert struct layout change to fix kexec boot regression
  2020-04-10  7:43 [PATCH] efi/x86: Revert struct layout change to fix kexec boot regression Ard Biesheuvel
@ 2020-04-10 13:56 ` Dave Young
  2020-04-10 14:01   ` Dave Young
  0 siblings, 1 reply; 7+ messages in thread
From: Dave Young @ 2020-04-10 13:56 UTC (permalink / raw)
  To: Ard Biesheuvel; +Cc: linux-efi, x86, tytso, bp, mingo, kexec

On 04/10/20 at 09:43am, Ard Biesheuvel wrote:
> Commit
> 
>   0a67361dcdaa29 ("efi/x86: Remove runtime table address from kexec EFI setup data")
> 
> removed the code that retrieves the non-remapped UEFI runtime services
> pointer from the data structure provided by kexec, as it was never really
> needed on the kexec boot path: mapping the runtime services table at its
> non-remapped address is only needed when calling SetVirtualAddressMap(),
> which never happens during a kexec boot in the first place.
> 
> However, dropping the 'runtime' member from struct efi_setup_data was a
> mistake. That struct is shared ABI between the kernel and the kexec tooling
> for x86, and so we cannot simply change its layout. So let's put back the
> removed field, but call it 'unused' to reflect the fact that we never look
> at its contents. While at it, add a comment to remind our future selves
> that the layout is external ABI.
> 
> Reported-by: Theodore Ts'o <tytso@mit.edu>
> Tested-by: Theodore Ts'o <tytso@mit.edu>
> Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
> ---
> 
> Ingo, Thomas, Boris: I sent out my efi-urgent pull request just yesterday,
> so please take this directly into tip:efi/urgent - no need to wait for the
> next batch.
> 
>  arch/x86/include/asm/efi.h | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/arch/x86/include/asm/efi.h b/arch/x86/include/asm/efi.h
> index 781170d36f50..96044c8d8600 100644
> --- a/arch/x86/include/asm/efi.h
> +++ b/arch/x86/include/asm/efi.h
> @@ -178,8 +178,10 @@ extern void efi_free_boot_services(void);
>  extern pgd_t * __init efi_uv1_memmap_phys_prolog(void);
>  extern void __init efi_uv1_memmap_phys_epilog(pgd_t *save_pgd);
>  
> +/* kexec external ABI */
>  struct efi_setup_data {
>  	u64 fw_vendor;
> +	u64 unused;
>  	u64 tables;
>  	u64 smbios;
>  	u64 reserved[8];
> -- 
> 2.17.1
> 

Ah, replied too quick in another mail.  I just cced kexec list again.

Thanks for the fix:

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

Thanks
Dave


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

* Re: [PATCH] efi/x86: Revert struct layout change to fix kexec boot regression
  2020-04-10 13:56 ` Dave Young
@ 2020-04-10 14:01   ` Dave Young
  2020-04-10 14:22     ` Ard Biesheuvel
  0 siblings, 1 reply; 7+ messages in thread
From: Dave Young @ 2020-04-10 14:01 UTC (permalink / raw)
  To: Ard Biesheuvel; +Cc: linux-efi, x86, tytso, bp, mingo, kexec

On 04/10/20 at 09:56pm, Dave Young wrote:
> On 04/10/20 at 09:43am, Ard Biesheuvel wrote:
> > Commit
> > 
> >   0a67361dcdaa29 ("efi/x86: Remove runtime table address from kexec EFI setup data")
> > 
> > removed the code that retrieves the non-remapped UEFI runtime services
> > pointer from the data structure provided by kexec, as it was never really
> > needed on the kexec boot path: mapping the runtime services table at its
> > non-remapped address is only needed when calling SetVirtualAddressMap(),
> > which never happens during a kexec boot in the first place.
> > 
> > However, dropping the 'runtime' member from struct efi_setup_data was a
> > mistake. That struct is shared ABI between the kernel and the kexec tooling
> > for x86, and so we cannot simply change its layout. So let's put back the
> > removed field, but call it 'unused' to reflect the fact that we never look
> > at its contents. While at it, add a comment to remind our future selves
> > that the layout is external ABI.
> > 
> > Reported-by: Theodore Ts'o <tytso@mit.edu>
> > Tested-by: Theodore Ts'o <tytso@mit.edu>
> > Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
> > ---
> > 
> > Ingo, Thomas, Boris: I sent out my efi-urgent pull request just yesterday,
> > so please take this directly into tip:efi/urgent - no need to wait for the
> > next batch.
> > 
> >  arch/x86/include/asm/efi.h | 2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > diff --git a/arch/x86/include/asm/efi.h b/arch/x86/include/asm/efi.h
> > index 781170d36f50..96044c8d8600 100644
> > --- a/arch/x86/include/asm/efi.h
> > +++ b/arch/x86/include/asm/efi.h
> > @@ -178,8 +178,10 @@ extern void efi_free_boot_services(void);
> >  extern pgd_t * __init efi_uv1_memmap_phys_prolog(void);
> >  extern void __init efi_uv1_memmap_phys_epilog(pgd_t *save_pgd);
> >  
> > +/* kexec external ABI */
> >  struct efi_setup_data {
> >  	u64 fw_vendor;
> > +	u64 unused;
> >  	u64 tables;
> >  	u64 smbios;
> >  	u64 reserved[8];
> > -- 
> > 2.17.1
> > 
> 
> Ah, replied too quick in another mail.  I just cced kexec list again.
> 
> Thanks for the fix:
> 
> Reviewed-by: Dave Young <dyoung@redhat.com>
> 

BTW, a fixes tag is good to have.. 


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

* Re: [PATCH] efi/x86: Revert struct layout change to fix kexec boot regression
  2020-04-10 14:01   ` Dave Young
@ 2020-04-10 14:22     ` Ard Biesheuvel
  2020-04-10 14:33       ` Borislav Petkov
  0 siblings, 1 reply; 7+ messages in thread
From: Ard Biesheuvel @ 2020-04-10 14:22 UTC (permalink / raw)
  To: Dave Young
  Cc: linux-efi, X86 ML, Theodore Y. Ts'o, Borislav Petkov,
	Ingo Molnar, kexec

On Fri, 10 Apr 2020 at 16:02, Dave Young <dyoung@redhat.com> wrote:
>
> On 04/10/20 at 09:56pm, Dave Young wrote:
> > On 04/10/20 at 09:43am, Ard Biesheuvel wrote:
> > > Commit
> > >
> > >   0a67361dcdaa29 ("efi/x86: Remove runtime table address from kexec EFI setup data")
> > >
> > > removed the code that retrieves the non-remapped UEFI runtime services
> > > pointer from the data structure provided by kexec, as it was never really
> > > needed on the kexec boot path: mapping the runtime services table at its
> > > non-remapped address is only needed when calling SetVirtualAddressMap(),
> > > which never happens during a kexec boot in the first place.
> > >
> > > However, dropping the 'runtime' member from struct efi_setup_data was a
> > > mistake. That struct is shared ABI between the kernel and the kexec tooling
> > > for x86, and so we cannot simply change its layout. So let's put back the
> > > removed field, but call it 'unused' to reflect the fact that we never look
> > > at its contents. While at it, add a comment to remind our future selves
> > > that the layout is external ABI.
> > >
> > > Reported-by: Theodore Ts'o <tytso@mit.edu>
> > > Tested-by: Theodore Ts'o <tytso@mit.edu>
> > > Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
> > > ---
> > >
> > > Ingo, Thomas, Boris: I sent out my efi-urgent pull request just yesterday,
> > > so please take this directly into tip:efi/urgent - no need to wait for the
> > > next batch.
> > >
> > >  arch/x86/include/asm/efi.h | 2 ++
> > >  1 file changed, 2 insertions(+)
> > >
> > > diff --git a/arch/x86/include/asm/efi.h b/arch/x86/include/asm/efi.h
> > > index 781170d36f50..96044c8d8600 100644
> > > --- a/arch/x86/include/asm/efi.h
> > > +++ b/arch/x86/include/asm/efi.h
> > > @@ -178,8 +178,10 @@ extern void efi_free_boot_services(void);
> > >  extern pgd_t * __init efi_uv1_memmap_phys_prolog(void);
> > >  extern void __init efi_uv1_memmap_phys_epilog(pgd_t *save_pgd);
> > >
> > > +/* kexec external ABI */
> > >  struct efi_setup_data {
> > >     u64 fw_vendor;
> > > +   u64 unused;
> > >     u64 tables;
> > >     u64 smbios;
> > >     u64 reserved[8];
> > > --
> > > 2.17.1
> > >
> >
> > Ah, replied too quick in another mail.  I just cced kexec list again.
> >
> > Thanks for the fix:
> >
> > Reviewed-by: Dave Young <dyoung@redhat.com>
> >
>

Thanks Dave

> BTW, a fixes tag is good to have..
>

I usually omit those for patches that fix bugs that were introduced in
the current cycle.

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

* Re: [PATCH] efi/x86: Revert struct layout change to fix kexec boot regression
  2020-04-10 14:22     ` Ard Biesheuvel
@ 2020-04-10 14:33       ` Borislav Petkov
  2020-04-10 14:37         ` Ard Biesheuvel
  0 siblings, 1 reply; 7+ messages in thread
From: Borislav Petkov @ 2020-04-10 14:33 UTC (permalink / raw)
  To: Ard Biesheuvel
  Cc: Dave Young, linux-efi, X86 ML, Theodore Y. Ts'o, Ingo Molnar,
	kexec

On Fri, Apr 10, 2020 at 04:22:49PM +0200, Ard Biesheuvel wrote:
> > BTW, a fixes tag is good to have..
> 
> I usually omit those for patches that fix bugs that were introduced in
> the current cycle.

A valid use case for having the Fixes: tag anyway are the backporting
kernels gangs which might pick up the first patch for whatever reason
and would probably be thankful if they find the second one, i.e., the
fix for the first one, through grepping or other, automated means.

Thx.

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette

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

* Re: [PATCH] efi/x86: Revert struct layout change to fix kexec boot regression
  2020-04-10 14:33       ` Borislav Petkov
@ 2020-04-10 14:37         ` Ard Biesheuvel
  2020-04-14  6:27           ` Ingo Molnar
  0 siblings, 1 reply; 7+ messages in thread
From: Ard Biesheuvel @ 2020-04-10 14:37 UTC (permalink / raw)
  To: Borislav Petkov
  Cc: Dave Young, linux-efi, X86 ML, Theodore Y. Ts'o, Ingo Molnar,
	kexec

On Fri, 10 Apr 2020 at 16:34, Borislav Petkov <bp@alien8.de> wrote:
>
> On Fri, Apr 10, 2020 at 04:22:49PM +0200, Ard Biesheuvel wrote:
> > > BTW, a fixes tag is good to have..
> >
> > I usually omit those for patches that fix bugs that were introduced in
> > the current cycle.
>
> A valid use case for having the Fixes: tag anyway are the backporting
> kernels gangs which might pick up the first patch for whatever reason
> and would probably be thankful if they find the second one, i.e., the
> fix for the first one, through grepping or other, automated means.
>

Fair point.

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

* Re: [PATCH] efi/x86: Revert struct layout change to fix kexec boot regression
  2020-04-10 14:37         ` Ard Biesheuvel
@ 2020-04-14  6:27           ` Ingo Molnar
  0 siblings, 0 replies; 7+ messages in thread
From: Ingo Molnar @ 2020-04-14  6:27 UTC (permalink / raw)
  To: Ard Biesheuvel
  Cc: Borislav Petkov, Dave Young, linux-efi, X86 ML,
	Theodore Y. Ts'o, kexec


* Ard Biesheuvel <ardb@kernel.org> wrote:

> On Fri, 10 Apr 2020 at 16:34, Borislav Petkov <bp@alien8.de> wrote:
> >
> > On Fri, Apr 10, 2020 at 04:22:49PM +0200, Ard Biesheuvel wrote:
> > > > BTW, a fixes tag is good to have..
> > >
> > > I usually omit those for patches that fix bugs that were introduced in
> > > the current cycle.
> >
> > A valid use case for having the Fixes: tag anyway are the backporting
> > kernels gangs which might pick up the first patch for whatever reason
> > and would probably be thankful if they find the second one, i.e., the
> > fix for the first one, through grepping or other, automated means.
> >
> 
> Fair point.

I've added:

  Fixes: 0a67361dcdaa29 ("efi/x86: Remove runtime table address from kexec EFI setup data")

Out of abundance of caution. :-)

Thanks,

	Ingo

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

end of thread, other threads:[~2020-04-14  6:27 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-04-10  7:43 [PATCH] efi/x86: Revert struct layout change to fix kexec boot regression Ard Biesheuvel
2020-04-10 13:56 ` Dave Young
2020-04-10 14:01   ` Dave Young
2020-04-10 14:22     ` Ard Biesheuvel
2020-04-10 14:33       ` Borislav Petkov
2020-04-10 14:37         ` Ard Biesheuvel
2020-04-14  6:27           ` Ingo Molnar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).