[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] EFI: refine cfgfile buffer allocation


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Ross Lagerwall <ross.lagerwall@xxxxxxxxxx>
  • Date: Mon, 28 Sep 2026 10:14:37 +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=VgSYmP9n7d6QwDbcjGRaR2t+3qRrHdduHrHKDr6U6Jw=; b=FE8ksMtM6AH9qhnlPyMYlANqbXyM7KhBUh3U3JaIMVi9un4F7Q626LTODUEhG4teQg9NNGiGUKcUlu4maglFfhGawDKlqg5bOZ2hBiuYoPdvvYCDj18jwubHHfoRArsuvpW3YP75KFwqIiGzZpPAiNseNdooglwxEvzQt8/ZqMf+DqxtWZ0dx1hUSNsHOnAf4+PgA/ea6PVEr+qBZR3HnggBg7WxgQhQ6gYsr6YDtY/QcA3zHaCcoYtKB3pGzjoPGOYnmuO854kGEAyyEnJ9L/Q4Qcralk+p32uDTn7kffYb9d13BfUMeXzWMyedeb6Z+jbV6cK5tAq9kfPcavrTFw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=HXxnZ33umLpcReqL1p1snfS0QT9IfMiIF0tMEpJJ/ZwBTC7LhynOuZ8yHImSYjIXLeL5nfEeUhjqrTObpLNdIuvCZ7Qzz1hxpoot6LLKuk8IHDZdtG0hjia0NFfEcpUh9E8aHG+fzVmsXQ7CcxVE7OW5ZBajE4uOoajzEiyIk+fiSaO5nqQLwnsYXSnZ4wBo9zQHeZb37xvuwY9g7hZWlSQaMJU/w2WCfVd8O4ZOjSLyOTy+2sArvdEEDrYV5WAYO3fZxiX4TAAeHs/eytMJvL2ncHRVBC4ouWuTFwdyH5h8uDbCMyUYAAj9gL/LqM6WLEnRuh2ZxlnYcc68ParOrg==
  • 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>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Mon, 28 Sep 2026 09:14:53 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 9/28/26 9:55 AM, Jan Beulich wrote:
On 28.09.2026 10:37, Ross Lagerwall wrote:
On 9/28/26 7:15 AM, Jan Beulich wrote:
On 25.09.2026 17:56, Ross Lagerwall wrote:
On 9/21/26 10:09 AM, Jan Beulich wrote:
--- 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?

Use of != was intentional, but that's not a "negation", so I'm not quite
sure I understand what you're referring to.

Sorry, I meant !=.

For the cfgfile, I don't think you need to allocate whole pages so it might be
better to use AllocatePool/FreePool for those allocations.

Yet that would further increase the difference between that and the other
allocations. See e.g. free_cfg(), which right now works uniformly.

free_cfg() is already a special case for freeing the cfgfile and it is handled
differently from the other allocations (in blexit()) so switching the FreePages
to FreePool in free_cfg() is surely no less uniform.

Ross



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.