public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Demi Marie Obenour <demi@invisiblethingslab.com>
To: Ard Biesheuvel <ardb@kernel.org>
Cc: "Peter Jones" <pjones@redhat.com>,
	"Juergen Gross" <jgross@suse.com>,
	"Stefano Stabellini" <sstabellini@kernel.org>,
	"Oleksandr Tyshchenko" <oleksandr_tyshchenko@epam.com>,
	"Kees Cook" <keescook@chromium.org>,
	"Anton Vorontsov" <anton@enomsg.org>,
	"Colin Cross" <ccross@android.com>,
	"Tony Luck" <tony.luck@intel.com>,
	"Marek Marczykowski-Górecki" <marmarek@invisiblethingslab.com>,
	xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org,
	linux-efi@vger.kernel.org
Subject: Re: [PATCH v4 2/2] Support ESRT in Xen dom0
Date: Fri, 30 Sep 2022 18:25:14 -0400	[thread overview]
Message-ID: <YzdszknqsmWsPsMZ@itl-email> (raw)
In-Reply-To: <CAMj1kXGTZZmW=QZOL1FvrsBLsvFzN1GkvZCotuZ-C-gBVGY6CQ@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 3452 bytes --]

On Fri, Sep 30, 2022 at 10:59:49PM +0200, Ard Biesheuvel wrote:
> On Fri, 30 Sept 2022 at 22:21, Demi Marie Obenour
> <demi@invisiblethingslab.com> wrote:
> >
> > On Fri, Sep 30, 2022 at 09:11:19PM +0200, Ard Biesheuvel wrote:
> > > On Fri, 30 Sept 2022 at 20:21, Demi Marie Obenour
> > > <demi@invisiblethingslab.com> wrote:
> > > >
> > > > On Fri, Sep 30, 2022 at 06:36:11PM +0200, Ard Biesheuvel wrote:
> > > > > On Fri, 30 Sept 2022 at 01:02, Demi Marie Obenour
> > > > > <demi@invisiblethingslab.com> wrote:
> > > > > >
> > > > > > fwupd requires access to the EFI System Resource Table (ESRT) to
> > > > > > discover which firmware can be updated by the OS.  Currently, Linux does
> > > > > > not expose the ESRT when running as a Xen dom0.  Therefore, it is not
> > > > > > possible to use fwupd in a Xen dom0, which is a serious problem for e.g.
> > > > > > Qubes OS.
> > > > > >
> > > > > > Before Xen 4.17, this was not fixable due to hypervisor limitations.
> > > > > > The UEFI specification requires the ESRT to be in EfiBootServicesData
> > > > > > memory, which Xen will use for whatever purposes it likes.  Therefore,
> > > > > > Linux cannot safely access the ESRT, as Xen may have overwritten it.
> > > > > >
> > > > > > Starting with Xen 4.17, Xen checks if the ESRT is in EfiBootServicesData
> > > > > > or EfiRuntimeServicesData memory.  If the ESRT is in EfiBootServicesData
> > > > > > memory, Xen replaces the ESRT with a copy in memory that it has
> > > > > > reserved.  Such memory is currently of type EFI_RUNTIME_SERVICES_DATA,
> > > > > > but in the future it will be of type EFI_ACPI_RECLAIM_MEMORY.  This
> > > > > > ensures that the ESRT can safely be accessed by the OS.
> > > > > >
> > > > > > When running as a Xen dom0, use the new
> > > > > > xen_config_table_memory_region_max() function to determine if Xen has
> > > > > > reserved the ESRT and, if so, find the end of the memory region
> > > > > > containing it.  This allows programs such as fwupd which require the
> > > > > > ESRT to run under Xen, and so makes fwupd support in Qubes OS possible.
> > > > > >
> > > > > > Signed-off-by: Demi Marie Obenour <demi@invisiblethingslab.com>
> > > > >
> > > > > Why do we need this patch? I'd expect esrt_table_exists() to return
> > > > > false when patch 1/2 is applied.
> > > >
> > > > efi_enabled(EFI_MEMMAP) is false under Xen, so there needs to be an
> > > > alternative way to get the end of the memory region containing the ESRT.
> > > > That is what this patch provides.
> > >
> > > OK. I don't think we need that to be honest. When running under Xen,
> > > we should be able to assume that the ESRT does not span multiple
> > > memory regions arbitrarily, so we can just omit this check if
> > > !efi_enabled(EFI_MEMMAP)
> > >
> > > IIRC (and Peter would know), we are trying to filter out descriptors
> > > that are completely bogus here: zero lenght, zero address, etc etc. I
> > > don't think we need that for Xen.
> >
> > Xen doesn’t uninstall bogus ESRTs, so there is no less reason to worry
> > under Xen than on bare hardware.
> 
> That may be true. But if Xen needs dom0 to be able to cross reference
> the EFI memory map, it should provide one (and set EFI_MEMMAP to
> enabled).

I agree, but it is also a significant amount of work compared to this
patch.
-- 
Sincerely,
Demi Marie Obenour (she/her/hers)
Invisible Things Lab

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

      parent reply	other threads:[~2022-09-30 22:25 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-29 23:02 [PATCH v4 0/2] EFI improvements for Xen dom0 Demi Marie Obenour
2022-09-29 23:02 ` [PATCH v4 1/2] Avoid using EFI tables Xen may have clobbered Demi Marie Obenour
2022-09-30  6:44   ` Jan Beulich
2022-09-30 16:30     ` Ard Biesheuvel
2022-09-30 17:11       ` Demi Marie Obenour
2022-09-30 18:27         ` Ard Biesheuvel
2022-09-30 18:50           ` Demi Marie Obenour
2022-10-01  0:30           ` Demi Marie Obenour
2022-10-04  8:22             ` Jan Beulich
2022-10-04 15:46               ` Demi Marie Obenour
2022-10-05  6:15                 ` Jan Beulich
2022-10-05 18:11                   ` Demi Marie Obenour
2022-10-05 21:28                     ` Ard Biesheuvel
2022-10-06  1:40                       ` Demi Marie Obenour
2022-10-06  7:31                         ` Ard Biesheuvel
2022-10-06 14:43                           ` Demi Marie Obenour
2022-10-06 16:19                             ` Ard Biesheuvel
2022-10-06 17:22                               ` Demi Marie Obenour
2022-10-06 17:56                                 ` Ard Biesheuvel
2022-10-06  9:22                     ` Jan Beulich
2022-09-30 16:38     ` Demi Marie Obenour
2022-09-30 16:25   ` Ard Biesheuvel
2022-09-30 18:15     ` Demi Marie Obenour
2022-09-30 18:42       ` Ard Biesheuvel
2022-09-30 19:00         ` Demi Marie Obenour
2022-09-29 23:02 ` [PATCH v4 2/2] Support ESRT in Xen dom0 Demi Marie Obenour
2022-09-30 16:36   ` Ard Biesheuvel
2022-09-30 18:21     ` Demi Marie Obenour
2022-09-30 19:11       ` Ard Biesheuvel
2022-09-30 20:20         ` Demi Marie Obenour
2022-09-30 20:59           ` Ard Biesheuvel
2022-09-30 21:24             ` Ard Biesheuvel
2022-09-30 22:22               ` Demi Marie Obenour
2022-09-30 22:25             ` Demi Marie Obenour [this message]

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:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

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

  git send-email \
    --in-reply-to=YzdszknqsmWsPsMZ@itl-email \
    --to=demi@invisiblethingslab.com \
    --cc=anton@enomsg.org \
    --cc=ardb@kernel.org \
    --cc=ccross@android.com \
    --cc=jgross@suse.com \
    --cc=keescook@chromium.org \
    --cc=linux-efi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marmarek@invisiblethingslab.com \
    --cc=oleksandr_tyshchenko@epam.com \
    --cc=pjones@redhat.com \
    --cc=sstabellini@kernel.org \
    --cc=tony.luck@intel.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox