[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] EFI: refine cfgfile buffer allocation
- To: Jan Beulich <jbeulich@xxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
- From: Ross Lagerwall <ross.lagerwall@xxxxxxxxxx>
- Date: Fri, 25 Sep 2026 16:56:50 +0100
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=IghoUeAQ6lR6+jW3M36ntpibzt/BdExoMnPGm953TLA=; b=yDDczON8YsJum4ciNoIGEx3A1q81RX/S1d1fDDK/xWZTJR57+R6EJ/vbNS/tQX0EvJ43ZsK8AHr4IFuOZ9+vj9IIQrRxH+CZDVi48NVQQM9oOiq+rvDXxMzPWkAGbeUhbG6Vjz3avRTnOOCvbP+d9mGaHpMsH8fRCY+iJS85+7iZ9sjBlI8jXjz9VCAVH35uBmgbjZUdYdzqQgaT2Zw9vaVTmCkM/8XZjQcLI1Nj4ffM4CsJ5l3FYXKYdRKLdNraYoHcZkVWbLqac2doHbAj3O2RnNamM2Wu/YDrRa/Ubft8rNCn6cV3iNjnlK1y3I6BbEKdD06x4DdHMTSQkhRqtA==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=UASHT7UgrtbYFL5uO+8BZoWAx9su039kM1CE1c5fQM7dWIALL6PWAiq3KrMhwPU418OUFzEvJKke9ZFkX1bm7uPfvGGwoMRWd0HxDFw3M8FMZm/d0mj+/E57JlYzwQydB4BwCtTnCTvexXEPH/qj84R59Fm3qgZg33Mt0zKFQLE4JHlBZLmES2LXyWbrUJWd+O5V3mT8Yzwiwk5ejqL34TAN5TDQMKHuj78tIdnsqwuRNFNvzbuZ7Hl4qfQbuOOtH8a/wppmH60E18dNq63sKwQB3dPvvKcSrvlHCT3txr95cKPclApkuh/YglcY5faWoIk1OYDspX3mw5cH6ZSzTw==
- Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=citrix.com header.i="@citrix.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck"
- Authentication-results: mx.microsoft.com 1; dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
- Cc: Marek Marczykowski <marmarek@xxxxxxxxxxxxxxxxxxxxxx>, Daniel Smith <dpsmith@xxxxxxxxxxxxxxxxxxxx>
- Delivery-date: Fri, 25 Sep 2026 15:57:20 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On 9/21/26 10:09 AM, Jan Beulich wrote:
Use of AllocateMaxAddress requires that the variable pointed to by the
last argument of ->AllocatePages() is initialized. For cfgfile buffers we
don't need AllocateMaxAddress though, at which point initialization of
"addr" also isn't necessary anymore.
Mirror the lack of address constraint also to the main / central buffer
allocation in read_file().
Fixes: df75f77092c1 ("EFI: avoid OOB config file reads")
Assisted-by: Sashiko + Opus 5.0
Reported-by: George Dunlap <dunlapg@xxxxxxxxx>
Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
--- a/xen/common/efi/boot.c
+++ b/xen/common/efi/boot.c
@@ -878,8 +878,13 @@ static bool __init read_file(EFI_FILE_HA
what = L"Allocation";
file->addr = min(1UL << (32 + PAGE_SHIFT),
HYPERVISOR_VIRT_END - DIRECTMAP_VIRT_START);
- /* For config files allocate an extra byte to put a NUL there. */
- ret = efi_bs->AllocatePages(AllocateMaxAddress, EfiLoaderData,
+ /*
+ * For config files allocate an extra byte to put a NUL there. There's
+ * also no constraint on addresses for them.
+ */
+ ret = efi_bs->AllocatePages(file != &cfg ? AllocateMaxAddress
+ : AllocateAnyPages,
You could avoid the negation here, unless it was intentional?
Ross
|