Skip to contentSkip to conversation

efi: payload: entry-single: memory need to be alloccated as data.

PATCH Applied [email protected] 3 participants 3 messages Sep 14, 2025 – Sep 15, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 efi: payload: entry-single: memory need to be alloccated as data.

From: Chali Anis <[email protected]>

The entry single is used in x86, this memory allocation need to be set to data since it is used to initialise the malloc memory. set all this region to loader code could represent a security issue since we autorise memory execution.

Fixes 7497c86c5032 ("efi: payload: early-mem: add memory type on early mem allocation")
---
 efi/payload/entry-single.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
efi/payload/entry-single.c +1 -1
index b7171bb24bfa..8600bd845c49 100644
@@ -37,7 +37,7 @@ void efi_main(efi_handle_t image, struct efi_system_table *sys_table)
 		BS->handle_protocol(efi_loaded_image->device_handle,
 				&efi_device_path_protocol_guid, (void **)&efi_device_path);
 
-	mem = efi_earlymem_alloc(sys_table, &memsize, EFI_LOADER_CODE);
+	mem = efi_earlymem_alloc(sys_table, &memsize, EFI_LOADER_DATA);
 
 	mem_malloc_init(mem, mem + memsize - 1);
 
Signature · 1 line
2.34.1
Reviewed-by on v1 1/1
#1 lore raw

Hi,

Quoted 9 lines · On 9/14/25 9:25 PM, [email protected] wrote:

From: Chali Anis <[email protected]>

The entry single is used in x86, this memory allocation need to be set to data since it is used to initialise the malloc memory. set all this region to loader code could represent a security issue since we autorise memory execution.

Fixes 7497c86c5032 ("efi: payload: early-mem: add memory type on early mem allocation")

Thanks,
Ahmad

Quoted 17 lines
---
 efi/payload/entry-single.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
efi/payload/entry-single.c +1 -1
index b7171bb24bfa..8600bd845c49 100644
@@ -37,7 +37,7 @@ void efi_main(efi_handle_t image, struct efi_system_table *sys_table)
 		BS->handle_protocol(efi_loaded_image->device_handle,
 				&efi_device_path_protocol_guid, (void **)&efi_device_path);
 
-	mem = efi_earlymem_alloc(sys_table, &memsize, EFI_LOADER_CODE);
+	mem = efi_earlymem_alloc(sys_table, &memsize, EFI_LOADER_DATA);
 
 	mem_malloc_init(mem, mem + memsize - 1);
 
Signature · 4 lines
Pengutronix e.K.                  |                             |
Steuerwalder Str. 21              | http://www.pengutronix.de/  |
31137 Hildesheim, Germany         | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686  | Fax:   +49-5121-206917-5555 |
Applied
#2 lore raw
In reply to [email protected]
Quoted 6 lines · On Sun, 14 Sep 2025 15:25:31 -0400, [email protected] wrote:

The entry single is used in x86, this memory allocation need to be set to data since it is used to initialise the malloc memory. set all this region to loader code could represent a security issue since we autorise memory execution.

Applied, thanks!

[1/1] efi: payload: entry-single: memory need to be alloccated as data.
https://git.pengutronix.de/cgit/barebox/commit/?id=3366e9e04a28 (link may not be stable)

Best regards,

Signature · 1 line
Sascha Hauer <[email protected]>