1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-23 21:35:11 +03:00

boot: Use correct memory type for allocations

We were using the wrong memory type when allocating pool memory. This
does not seem to cause a problem on x86, but the kernel will fail to
boot at least on ARM in QEMU.

This is caused by mixing different allocation types which ended up
breaking the kernel or EDK2 during boot services exit. Commit
2f3c3b0bee appears to fix this boot
failure because it was replacing the gnu-efi xpool_print with xasprintf
thereby unifying the allocation type.
But this same issue can also happen without this fix somehow when the
random-seed logic is in use.

Fixes: #27371
This commit is contained in:
Jan Janssen 2023-05-02 19:41:58 +02:00 committed by Luca Boccassi
parent 845824acdd
commit ec232e4abd

View File

@ -28,7 +28,7 @@ static inline void freep(void *p) {
_malloc_ _alloc_(1) _returns_nonnull_ _warn_unused_result_
static inline void *xmalloc(size_t size) {
void *p;
assert_se(BS->AllocatePool(EfiBootServicesData, size, &p) == EFI_SUCCESS);
assert_se(BS->AllocatePool(EfiLoaderData, size, &p) == EFI_SUCCESS);
return p;
}