]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
boot: Use correct memory type for allocations
authorJan Janssen <medhefgo@web.de>
Tue, 2 May 2023 17:41:58 +0000 (19:41 +0200)
committerLuca Boccassi <luca.boccassi@gmail.com>
Tue, 2 May 2023 21:38:15 +0000 (22:38 +0100)
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
2f3c3b0bee5534f2338439f04b0aa517479f8b76 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
src/boot/efi/util.h

index 9df7b4a2d4e833e1e252707c5c140027c93524b0..9058918a93915c1d8ed4a05d3902e114cc7f4738 100644 (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;
 }