diff mbox series

[v2,14/14] efi: change heap allocation type to GRUB_EFI_LOADER_CODE

Message ID 20170803100432.29913-15-leif.lindholm@linaro.org
State Accepted
Commit f826330683675f0deb55b58fd229afd7d65fb053
Headers show
Series efi: improved correctness, arm unification, and cleanup | expand

Commit Message

Leif Lindholm Aug. 3, 2017, 10:04 a.m. UTC
With upcoming changes to EDK2, allocations of type EFI_LOADER_DATA may
not return regions with execute ability. Since modules are loaded onto
the heap, change the heap allocation type to GRUB_EFI_LOADER_CODE in
order to permit execution on systems with this feature enabled.

Closes: 50420

Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>

---
 grub-core/kern/efi/mm.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

-- 
2.11.0


_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

Comments

Vladimir 'phcoder' Serbinenko Aug. 7, 2017, 2:11 p.m. UTC | #1
LGTM

Le Thu, Aug 3, 2017 à 12:09 PM, Leif Lindholm <leif.lindholm@linaro.org> a
écrit :

> With upcoming changes to EDK2, allocations of type EFI_LOADER_DATA may

> not return regions with execute ability. Since modules are loaded onto

> the heap, change the heap allocation type to GRUB_EFI_LOADER_CODE in

> order to permit execution on systems with this feature enabled.

>

> Closes: 50420

>

> Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>

> ---

>  grub-core/kern/efi/mm.c | 4 +++-

>  1 file changed, 3 insertions(+), 1 deletion(-)

>

> diff --git a/grub-core/kern/efi/mm.c b/grub-core/kern/efi/mm.c

> index c8fffe902..f1424f2e4 100644

> --- a/grub-core/kern/efi/mm.c

> +++ b/grub-core/kern/efi/mm.c

> @@ -448,7 +448,9 @@ add_memory_regions (grub_efi_memory_descriptor_t

> *memory_map,

>           pages = required_pages;

>         }

>

> -      addr = grub_efi_allocate_pages (start, pages);

> +      addr = grub_efi_allocate_pages_real (start, pages,

> +                                          GRUB_EFI_ALLOCATE_ADDRESS,

> +                                          GRUB_EFI_LOADER_CODE);

>        if (! addr)

>         grub_fatal ("cannot allocate conventional memory %p with %u pages",

>                     (void *) ((grub_addr_t) start),

> --

> 2.11.0

>

>

> _______________________________________________

> Grub-devel mailing list

> Grub-devel@gnu.org

> https://lists.gnu.org/mailman/listinfo/grub-devel

>
_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel
Konrad Rzeszutek Wilk Aug. 7, 2017, 4:18 p.m. UTC | #2
On Mon, Aug 07, 2017 at 02:11:16PM +0000, Vladimir 'phcoder' Serbinenko wrote:
> LGTM


Is LGTM equivalant to Acked-by?

> 

> Le Thu, Aug 3, 2017 à 12:09 PM, Leif Lindholm <leif.lindholm@linaro.org> a

> écrit :

> 

> > With upcoming changes to EDK2, allocations of type EFI_LOADER_DATA may

> > not return regions with execute ability. Since modules are loaded onto

> > the heap, change the heap allocation type to GRUB_EFI_LOADER_CODE in

> > order to permit execution on systems with this feature enabled.

> >

> > Closes: 50420

> >

> > Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>

> > ---

> >  grub-core/kern/efi/mm.c | 4 +++-

> >  1 file changed, 3 insertions(+), 1 deletion(-)

> >

> > diff --git a/grub-core/kern/efi/mm.c b/grub-core/kern/efi/mm.c

> > index c8fffe902..f1424f2e4 100644

> > --- a/grub-core/kern/efi/mm.c

> > +++ b/grub-core/kern/efi/mm.c

> > @@ -448,7 +448,9 @@ add_memory_regions (grub_efi_memory_descriptor_t

> > *memory_map,

> >           pages = required_pages;

> >         }

> >

> > -      addr = grub_efi_allocate_pages (start, pages);

> > +      addr = grub_efi_allocate_pages_real (start, pages,

> > +                                          GRUB_EFI_ALLOCATE_ADDRESS,

> > +                                          GRUB_EFI_LOADER_CODE);

> >        if (! addr)

> >         grub_fatal ("cannot allocate conventional memory %p with %u pages",

> >                     (void *) ((grub_addr_t) start),

> > --

> > 2.11.0

> >

> >

> > _______________________________________________

> > Grub-devel mailing list

> > Grub-devel@gnu.org

> > https://lists.gnu.org/mailman/listinfo/grub-devel

> >


> _______________________________________________

> Grub-devel mailing list

> Grub-devel@gnu.org

> https://lists.gnu.org/mailman/listinfo/grub-devel



_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel
Vladimir 'phcoder' Serbinenko Aug. 7, 2017, 4:22 p.m. UTC | #3
It means that the patch is fine but something else stops it from being
committed. In this case I wanted to go through the whole stack first

Le Mon, Aug 7, 2017 à 6:19 PM, Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
a écrit :

> On Mon, Aug 07, 2017 at 02:11:16PM +0000, Vladimir 'phcoder' Serbinenko

> wrote:

> > LGTM

>

> Is LGTM equivalant to Acked-by?

>

> >

> > Le Thu, Aug 3, 2017 à 12:09 PM, Leif Lindholm <leif.lindholm@linaro.org>

> a

> > écrit :

> >

> > > With upcoming changes to EDK2, allocations of type EFI_LOADER_DATA may

> > > not return regions with execute ability. Since modules are loaded onto

> > > the heap, change the heap allocation type to GRUB_EFI_LOADER_CODE in

> > > order to permit execution on systems with this feature enabled.

> > >

> > > Closes: 50420

> > >

> > > Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>

> > > ---

> > >  grub-core/kern/efi/mm.c | 4 +++-

> > >  1 file changed, 3 insertions(+), 1 deletion(-)

> > >

> > > diff --git a/grub-core/kern/efi/mm.c b/grub-core/kern/efi/mm.c

> > > index c8fffe902..f1424f2e4 100644

> > > --- a/grub-core/kern/efi/mm.c

> > > +++ b/grub-core/kern/efi/mm.c

> > > @@ -448,7 +448,9 @@ add_memory_regions (grub_efi_memory_descriptor_t

> > > *memory_map,

> > >           pages = required_pages;

> > >         }

> > >

> > > -      addr = grub_efi_allocate_pages (start, pages);

> > > +      addr = grub_efi_allocate_pages_real (start, pages,

> > > +                                          GRUB_EFI_ALLOCATE_ADDRESS,

> > > +                                          GRUB_EFI_LOADER_CODE);

> > >        if (! addr)

> > >         grub_fatal ("cannot allocate conventional memory %p with %u

> pages",

> > >                     (void *) ((grub_addr_t) start),

> > > --

> > > 2.11.0

> > >

> > >

> > > _______________________________________________

> > > Grub-devel mailing list

> > > Grub-devel@gnu.org

> > > https://lists.gnu.org/mailman/listinfo/grub-devel

> > >

>

> > _______________________________________________

> > Grub-devel mailing list

> > Grub-devel@gnu.org

> > https://lists.gnu.org/mailman/listinfo/grub-devel

>

>

> _______________________________________________

> Grub-devel mailing list

> Grub-devel@gnu.org

> https://lists.gnu.org/mailman/listinfo/grub-devel

>
_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel
diff mbox series

Patch

diff --git a/grub-core/kern/efi/mm.c b/grub-core/kern/efi/mm.c
index c8fffe902..f1424f2e4 100644
--- a/grub-core/kern/efi/mm.c
+++ b/grub-core/kern/efi/mm.c
@@ -448,7 +448,9 @@  add_memory_regions (grub_efi_memory_descriptor_t *memory_map,
 	  pages = required_pages;
 	}
 
-      addr = grub_efi_allocate_pages (start, pages);
+      addr = grub_efi_allocate_pages_real (start, pages,
+					   GRUB_EFI_ALLOCATE_ADDRESS,
+					   GRUB_EFI_LOADER_CODE);
       if (! addr)
 	grub_fatal ("cannot allocate conventional memory %p with %u pages",
 		    (void *) ((grub_addr_t) start),