I observed the code and it seems to be a false positive in GCC. I wrote a little patch that silences the warning:
From a033f9c535e41140a3138edbb0d6a89be0e80564 Mon Sep 17 00:00:00 2001
From: Xen Arch <user@xen-arch>
Date: Sat, 6 May 2023 17:58:47 +0200
Subject: [PATCH] Silence false positive use after free warning
---
tools/libs/guest/xg_offline_page.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/tools/libs/guest/xg_offline_page.c b/tools/libs/guest/xg_offline_page.c
index ccd0299f0f..96f197a801 100644
--- a/tools/libs/guest/xg_offline_page.c
+++ b/tools/libs/guest/xg_offline_page.c
@@ -182,9 +182,11 @@ static int backup_ptes(xen_pfn_t table_mfn, int offset,
if (backup->max == backup->cur)
{
void *orig = backup->entries;
+ // silence false positive warning
+ void *orig2 = orig;
backup->entries = realloc(
- orig, backup->max * 2 * sizeof(struct pte_backup_entry));
+ orig2, backup->max * 2 * sizeof(struct pte_backup_entry));
if (backup->entries == NULL)
{
--
2.40.1
Simply save it as a .patch file, and drop it in the same folder as the PKGBUILD. Run sha512sum on it and put the patch file in the _patches list and the sha512 sum in the _patch_sums list.
Pinned Comments
Refutationalist commented on 2022-11-15 02:32 (UTC) (edited on 2022-11-16 00:13 (UTC) by Refutationalist)
Important: QEMU is now it's own package. See xen-qemu.
Here's my updated Xen, which now tracks git stable, as suggested by the Xen security team. For more information about the build, check my PKGBUILD git repo: https://github.com/refutationalist/saur
xen-pvhgrub, a method for booting kernels inside a PVH domain will be in AUR as soon as it lets me. I'm going to be looking into a package repo for now.
EDIT: xen-pvhgrub is now available in AUR.