public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Michael D Kinney" <michael.d.kinney@intel.com>
To: Ard Biesheuvel <ard.biesheuvel@linaro.org>,
	edk2-devel-groups-io <devel@edk2.groups.io>,
	"Kinney, Michael D" <michael.d.kinney@intel.com>
Cc: "Wu, Hao A" <hao.a.wu@intel.com>, "Wang, Jian J" <jian.j.wang@intel.com>
Subject: Re: [edk2-devel] [PATCH v2] MdeModulePkg/DxeCapsuleLibFmp: avoid ESRT accesses at runtime
Date: Mon, 22 Apr 2019 23:02:28 +0000	[thread overview]
Message-ID: <E92EE9817A31E24EB0585FDF735412F5B9C9CBD7@ORSMSX113.amr.corp.intel.com> (raw)
In-Reply-To: <CAKv+Gu8C6EhxAMmr2a9M=2KMX5jPtzdsuq5yidqZ--5pjzBWJw@mail.gmail.com>

Ard,

I agree. Only consumer is only the DxeCapsuleLibFmp
itself.

I see I had a typo on the second option.  The
statement to add after the copy and ASSERT() 
would be:

  mEsrtTable->FwResourceCountMax = FwResourceCount;

Mike

> -----Original Message-----
> From: Ard Biesheuvel [mailto:ard.biesheuvel@linaro.org]
> Sent: Monday, April 22, 2019 3:40 PM
> To: edk2-devel-groups-io <devel@edk2.groups.io>; Kinney,
> Michael D <michael.d.kinney@intel.com>
> Cc: Wu, Hao A <hao.a.wu@intel.com>; Wang, Jian J
> <jian.j.wang@intel.com>
> Subject: Re: [edk2-devel] [PATCH v2]
> MdeModulePkg/DxeCapsuleLibFmp: avoid ESRT accesses at
> runtime
> 
> On Tue, 23 Apr 2019 at 00:37, Michael D Kinney
> <michael.d.kinney@intel.com> wrote:
> >
> > Ard,
> >
> > I only see one potential issue.
> >
> > The size of the buffer copied is based on the
> FwResourceCount field.
> > The actual size of based on the FwResourceCountMax
> field.  Your patch
> > does not set FwResourceCountMax to FwResourceCount, so
> this may confuse
> > the OS consumers that may think the buffer allocated
> for ESRT is larger
> > that is actually is.
> >
> >   ///
> >   /// The number of firmware resources in the table,
> must not be zero.
> >   ///
> >   UINT32                     FwResourceCount;
> >   ///
> >   /// The maximum number of resource array entries
> that can be within the table
> >   /// without reallocating the table, must not be
> zero.
> >   ///
> >   UINT32                     FwResourceCountMax;
> >
> 
> The OS never sees our copy of the table. That copy is
> for internal use
> only by the DxeCapsuleLibFmp implementation.
> 
> > The simplest fix is to use FwResourceCountMax instead
> of FwResourceCount
> > for the copy size.  The other option is to set
> FwResourceCountMax to
> > FwResourceCountMax after the copy.
> >
> 
> Given the above, I'll go with the latter. It is unlikely
> to matter,
> but it is more correct, and prevents any potential
> confusion in the
> future.
> 
> > The rest of the patch looks good.  With one of the two
> changes above:
> >
> > Reviewed-by: Michael D Kinney
> <michael.d.kinney@intel.com>
> >
> 
> Thanks.
> 
> >
> > > -----Original Message-----
> > > From: devel@edk2.groups.io
> > > [mailto:devel@edk2.groups.io] On Behalf Of Ard
> > > Biesheuvel
> > > Sent: Monday, April 22, 2019 3:03 PM
> > > To: Wu, Hao A <hao.a.wu@intel.com>
> > > Cc: devel@edk2.groups.io; Wang, Jian J
> > > <jian.j.wang@intel.com>; Kinney, Michael D
> > > <michael.d.kinney@intel.com>
> > > Subject: Re: [edk2-devel] [PATCH v2]
> > > MdeModulePkg/DxeCapsuleLibFmp: avoid ESRT accesses
> at
> > > runtime
> > >
> > > On Mon, 22 Apr 2019 at 09:14, Wu, Hao A
> > > <hao.a.wu@intel.com> wrote:
> > > >
> > > > > -----Original Message-----
> > > > > From: devel@edk2.groups.io
> > > [mailto:devel@edk2.groups.io] On Behalf Of Ard
> > > > > Biesheuvel
> > > > > Sent: Saturday, April 20, 2019 6:35 PM
> > > > > To: devel@edk2.groups.io
> > > > > Cc: Wu, Hao A; Wang, Jian J; Kinney, Michael D;
> Ard
> > > Biesheuvel
> > > > > Subject: [edk2-devel] [PATCH v2]
> > > MdeModulePkg/DxeCapsuleLibFmp: avoid
> > > > > ESRT accesses at runtime
> > > >
> > > > Hello Ard,
> > > >
> > > > It seems to me v2 patch makes a copy of the ESRT
> for
> > > runtime usage (rather
> > > > than avoid using ESRT), so the title of the commit
> > > may need update as
> > > > well.
> > > >
> > > > Could you help to update the patch subject when
> you
> > > push the change?
> > > >
> > > > Other than that, the patch looks good to me. But I
> > > would like to see if
> > > > Mike has additional comments on this:
> > > >
> > > > Acked-by: Hao Wu <hao.a.wu@intel.com>
> > > >
> > >
> > > Thanks Hao. I will modify the subject to 'clone ESRT
> > > for runtime access'
> > >
> > > Mike: any comments?
> > >
> > >
> >
> >
> > 
> >

  reply	other threads:[~2019-04-22 23:02 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-20 10:34 [PATCH v2] MdeModulePkg/DxeCapsuleLibFmp: avoid ESRT accesses at runtime Ard Biesheuvel
2019-04-22  7:14 ` [edk2-devel] " Wu, Hao A
2019-04-22 22:03   ` Ard Biesheuvel
2019-04-22 22:37     ` Michael D Kinney
2019-04-22 22:40       ` Ard Biesheuvel
2019-04-22 23:02         ` Michael D Kinney [this message]
2019-04-23 16:52           ` Ard Biesheuvel

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-list 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=E92EE9817A31E24EB0585FDF735412F5B9C9CBD7@ORSMSX113.amr.corp.intel.com \
    --to=devel@edk2.groups.io \
    /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