public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
To: "Gao, Liming" <liming.gao@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>,
	Andrew Jones <drjones@redhat.com>,
	 "Wu, Hao A" <hao.a.wu@intel.com>,
	"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>,
	 "Kinney, Michael D" <michael.d.kinney@intel.com>,
	Laszlo Ersek <lersek@redhat.com>
Subject: Re: [RFC PATCH 3/7] MdeModulePkg/Dxe/Page: take MAX_ALLOC_ADDRESS into account
Date: Mon, 10 Dec 2018 15:53:33 +0100	[thread overview]
Message-ID: <CAKv+Gu-LDF82bOJyA0K1mP9Usch9odp7_VF55wUvxiBA1Nm=6g@mail.gmail.com> (raw)
In-Reply-To: <4A89E2EF3DFEDB4C8BFDE51014F606A14E3898F8@SHSMSX104.ccr.corp.intel.com>

On Mon, 10 Dec 2018 at 15:52, Gao, Liming <liming.gao@intel.com> wrote:
>
> Ard:
>   I prefer to define MAX_ALLOC_ADDRESS together with MAX_ADDRESS in ProcessorBind.h. I don't want to leave the choice to override MAX_ALLOC_ADDRESS definition.
>

Seems reasonable. What should be the value for X64?

> Thanks
> Liming
> > -----Original Message-----
> > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Ard Biesheuvel
> > Sent: Monday, December 10, 2018 3:23 PM
> > To: Wang, Jian J <jian.j.wang@intel.com>
> > Cc: Andrew Jones <drjones@redhat.com>; Wu, Hao A <hao.a.wu@intel.com>; edk2-devel@lists.01.org; Gao, Liming
> > <liming.gao@intel.com>; Kinney, Michael D <michael.d.kinney@intel.com>; Laszlo Ersek <lersek@redhat.com>
> > Subject: Re: [edk2] [RFC PATCH 3/7] MdeModulePkg/Dxe/Page: take MAX_ALLOC_ADDRESS into account
> >
> > On Mon, 10 Dec 2018 at 03:04, Wang, Jian J <jian.j.wang@intel.com> wrote:
> > >
> > > Hi Ard,
> > >
> > > I think MAX_ALLOC_ADDRESS will affect other archs besides ARM. Please do enough
> > > test for them (IA32/X64 for my concern).
> > >
> >
> > For all other architectures, MAX_ADDRESS == MAX_ALLOC_ADDRESS is
> > always true, so these changes only affect AARCH64.
> >
> > > In addition, do you think it's safer to replace MAX_ADDRESS with MAX_ALLOC_ADDRESS
> > > in MemoryAllocationLib like following situation?
> > >
> > > (MdeModulePkg\Library\DxeCoreMemoryAllocationLib\MemoryAllocationLib.c)
> > > VOID *
> > > InternalAllocateCopyPool (
> > >   IN EFI_MEMORY_TYPE  PoolType,
> > >   IN UINTN            AllocationSize,
> > >   IN CONST VOID       *Buffer
> > >   )
> > > {
> > >   VOID  *Memory;
> > >
> > >   ASSERT (Buffer != NULL);
> > >   ASSERT (AllocationSize <= (MAX_ADDRESS - (UINTN) Buffer + 1));
> > >   ...
> >
> > This assert ensures that the copied buffer does not extend across the
> > end of the address space and wraps. This is a separate concern, and is
> > similar to numerous other occurrences of MAX_ADDRESS that maybe we
> > should update as well at some point. However, it does not affect page
> > allocation at all, it only puts an upper bound on the *size* of the
> > allocation. So the changes as they are will be sufficient to ensure
> > that AllocateCopyPool() does not allocate from a region that is not
> > addressable by the CPU.
> > _______________________________________________
> > edk2-devel mailing list
> > edk2-devel@lists.01.org
> > https://lists.01.org/mailman/listinfo/edk2-devel


  reply	other threads:[~2018-12-10 14:53 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-07 11:22 [RFC PATCH 0/7] introduce MAX_ALLOC_ADDRESS to limit boot time allocations Ard Biesheuvel
2018-12-07 11:22 ` [RFC PATCH 1/7] MdePkg/Base: introduce MAX_ALLOC_ADDRESS Ard Biesheuvel
2018-12-07 12:53   ` Laszlo Ersek
2018-12-07 11:22 ` [RFC PATCH 2/7] MdeModulePkg/Dxe/Gcd: disregard memory above MAX_ALLOC_ADDRESS Ard Biesheuvel
2018-12-07 11:23 ` [RFC PATCH 3/7] MdeModulePkg/Dxe/Page: take MAX_ALLOC_ADDRESS into account Ard Biesheuvel
2018-12-10  2:04   ` Wang, Jian J
2018-12-10  7:22     ` Ard Biesheuvel
2018-12-10 14:52       ` Gao, Liming
2018-12-10 14:53         ` Ard Biesheuvel [this message]
2018-12-10 14:57           ` Gao, Liming
2018-12-07 11:23 ` [RFC PATCH 4/7] ArmPkg/ArmMmuLib: " Ard Biesheuvel
2018-12-07 12:42   ` Laszlo Ersek
2018-12-07 11:23 ` [RFC PATCH 5/7] ArmPlatformPkg/MemoryInitPeim: " Ard Biesheuvel
2018-12-07 12:46   ` Laszlo Ersek
2018-12-07 12:47     ` Ard Biesheuvel
2018-12-07 12:48       ` Ard Biesheuvel
2018-12-07 11:23 ` [RFC PATCH 6/7] ArmVirtPkg/MemoryInitPeiLib: split memory HOB based on MAX_ALLOC_ADDRESS Ard Biesheuvel
2018-12-07 12:47   ` Laszlo Ersek
2018-12-07 11:23 ` [RFC PATCH 7/7] MdePkg/ProcessorBind AARCH64: limit MAX_ALLOC_ADDRESS to 48 bits Ard Biesheuvel
2018-12-07 12:51   ` Laszlo Ersek

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='CAKv+Gu-LDF82bOJyA0K1mP9Usch9odp7_VF55wUvxiBA1Nm=6g@mail.gmail.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