archive mirror
 help / color / mirror / Atom feed
From: Dave Young <>
To: Ard Biesheuvel <>
Cc: linux-efi <>,
	Kexec Mailing List <>,
	Linux Kernel Mailing List <>,
	Matthew Garrett <>,
	Bhupesh Sharma <>
Subject: Re: [PATCH] do not clean dummy variable in kexec path
Date: Thu, 8 Aug 2019 15:49:04 +0800	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <>

On 08/05/19 at 06:55pm, Ard Biesheuvel wrote:
> On Mon, 5 Aug 2019 at 11:36, Dave Young <> wrote:
> >
> > kexec reboot fails randomly in UEFI based kvm guest.  The firmware
> > just reset while calling efi_delete_dummy_variable();  Unfortunately
> > I don't know how to debug the firmware, it is also possible a potential
> > problem on real hardware as well although nobody reproduced it.
> >
> > The intention of efi_delete_dummy_variable is to trigger garbage collection
> > when entering virtual mode.  But SetVirtualAddressMap can only run once
> > for each physical reboot, thus kexec_enter_virtual_mode is not necessarily
> > a good place to clean dummy object.
> >
> I would argue that this means it is not a good place to *create* the
> dummy variable, and if we don't create it, we don't have to delete it
> either.
> > Drop efi_delete_dummy_variable so that kexec reboot can work.
> >
> Creating it and not deleting it is bad, so please try and see if we
> can omit the creation on this code path instead.

Check the code for the dummy var, it is created only in below chunk:
	 * We account for that by refusing the write if permitting it would
	 * reduce the available space to under 5KB. This figure was provided by
	 * Samsung, so should be safe.
	if ((remaining_size - size < EFI_MIN_RESERVE) &&
		!efi_no_storage_paranoia) {

		 * Triggering garbage collection may require that the firmware
		 * generate a real EFI_OUT_OF_RESOURCES error. We can force
		 * that by attempting to use more space than is available.
		unsigned long dummy_size = remaining_size + 1024;
		void *dummy = kzalloc(dummy_size, GFP_KERNEL);

		if (!dummy)

		status = efi.set_variable((efi_char16_t *)efi_dummy_name,
					  dummy_size, dummy);

		if (status == EFI_SUCCESS) {
			 * This should have failed, so if it didn't make sure
			 * that we delete it...


So the dummy var only be created when the if condition matched, also
once creating succeeded it is deleted.  The deleting while entering
virtual mode is always deleting a non exist efi var.  Please correct me
if I miss something. 

If above is true, then at least in the kexec path can be dropped because
we have a real bug which resets machine.


  parent reply	other threads:[~2019-08-08  7:49 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-05  8:35 Dave Young
2019-08-05 15:55 ` Ard Biesheuvel
2019-08-06  2:41   ` Dave Young
2019-08-08  7:49   ` Dave Young [this message]
2019-08-05 17:09 ` Matthew Garrett
2019-08-06  2:44   ` Dave Young

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \ \ \ \ \
    --subject='Re: [PATCH] do not clean dummy variable in kexec path' \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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).