From nobody Tue Feb 10 03:21:02 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1754411550; cv=none; d=zohomail.com; s=zohoarc; b=kguHd8BwnIeXiMRQvYCoITcRJJ3wFxrTaGiGATlGTi+IX4ciH+PdLHhmKJvIDVwzHs0Z/sL1GRwC3mJeuiNaL/OQMdQ0MF7wX/l77G8yAhZyTR9EYkr0/nSBH2RHvT1AmQS5GpBtH0/JhDZx4qNv2uUzr2C5IlRwMHuahZ8HDkQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1754411550; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=HyChThRw6GVKg1romDTn5fzN51ukPoZgESaAn7xK/ic=; b=gMTp17eiykjthfBTw86nKTu1hMea5VDsB645ddbT/Yw9EaCGBx3L+tCCTxVgn1Wx0SepGWDd5231j+c4My8L6Jq+HofX0DF9x0Swqh3z18SufSVIpVoSqEotUxk0Sao9Wh3nxjmXitDv2jdK+hIT9WJ9JSVV6mmuFyxjGtYbwyo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 175441155098223.10197013885454; Tue, 5 Aug 2025 09:32:30 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1070747.1434393 (Exim 4.92) (envelope-from ) id 1ujKaF-0003Q7-29; Tue, 05 Aug 2025 16:32:15 +0000 Received: by outflank-mailman (output) from mailman id 1070747.1434393; Tue, 05 Aug 2025 16:32:15 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ujKaE-0003Q0-Rt; Tue, 05 Aug 2025 16:32:14 +0000 Received: by outflank-mailman (input) for mailman id 1070747; Tue, 05 Aug 2025 16:32:13 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ujKaD-0002gS-GK for xen-devel@lists.xen.org; Tue, 05 Aug 2025 16:32:13 +0000 Received: from mail-ej1-x629.google.com (mail-ej1-x629.google.com [2a00:1450:4864:20::629]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id bcf8c4fa-7219-11f0-b898-0df219b8e170; Tue, 05 Aug 2025 18:32:12 +0200 (CEST) Received: by mail-ej1-x629.google.com with SMTP id a640c23a62f3a-af967835d0aso402887866b.0 for ; Tue, 05 Aug 2025 09:32:12 -0700 (PDT) Received: from rossla-pc.eng.citrite.net ([185.25.67.249]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-af928c84154sm842980766b.84.2025.08.05.09.32.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Aug 2025 09:32:10 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: bcf8c4fa-7219-11f0-b898-0df219b8e170 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1754411531; x=1755016331; darn=lists.xen.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=HyChThRw6GVKg1romDTn5fzN51ukPoZgESaAn7xK/ic=; b=RjULSuQGaRH2h2sfIspmByy/vWktiO82zs8pqNmjM14Iy/56Vun4ihCiMzzcwGhEZP shDlH6SH1uoUFQ8TuHES6hZLIHQGiM1cGnYxYFB2aQUSz9HVJE2hW36xoXyxJkmyle6E +g/7os73Lmsfs8aK0vzDs+F3pjUr+VuEsj+Qw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1754411531; x=1755016331; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=HyChThRw6GVKg1romDTn5fzN51ukPoZgESaAn7xK/ic=; b=j+i+kJo+7AwLwK92Wcy0AYQARJmBmEeoAq/bNDNDYpUxfIOhgmAQvBbea44AFxiZM0 JJNt0Gga6lt7sQFyV0ry9nLQNei2W3Vvll2p1oBLBydWP8rB9vJvsP2wA9lM/E1IvyOm F1KmGgocyoRbN+32FBrsCiLc6wBNH1oxEc83urKl4FjYRZaWMfDhtdeSuJ5syWlDKgo1 85jEGHiLFhf22OKJuA63InAp7kaLKMC4ReK88I8VIueJvi6oIGcIy09MdqTSaDoZ3UP4 Edmr9cBnXEBtujlK4PCogOOqMij39/wM7P1ULFRnV9NXso+prQRDtD1xs5usrV6BX1dD 6j5g== X-Gm-Message-State: AOJu0YwLirlRqq4SF734kR4hkU1yGcreq2PUunE00a3u+zIHMv6Zn497 bfDpEUHAybnI3iD7VMsa1nKEIgtQ6vXv3M2dFIdY4yK05YRMVt7M2cCVTpjpjK6zBnIcyUAt3R2 efS8= X-Gm-Gg: ASbGncvIV0J8S1QdT8rf7BsAOj8PPKv/8lp19zQuqlLEg1nUZgaWfZnuLaqjECj7TBT 1vwIGiYk0jgj5R79ycv0aYBJdZyaZnCkQwP5xsQQj8TvQeCMIdRRIHBh94/3rTN+SlEGykCkZtf uzi1QmkFIfeXVRbpBKM2AQXH98BHLHg0+FvTXbFa2QnNZqOK4vGzlAVhscDdV7dNcjvHj8gpT3z tlPy8d/JRhJeneFD1ew6kSbE5aOiuJQEMuaZxu7IzPoWw+kjqBLgR5EhHeBmg0wvcaNP7Joer2g T6uKp4PD0t3X9SzctLHvpfEo3w0R5xuy41Ljg1Ty84rd74o7EkA+iLMCJQkXF7UcI1+r4N5Gesh c0v9RoHEoTTaA28M3cO/Jwda2inq6MTyTXVoKQXEiqsfr3g== X-Google-Smtp-Source: AGHT+IHfJbaJv57Bho8r5sfyd+qAP9P2dr44hKcu2gIKy6YgKG5c4omoNyMg3Ahg2Rn7mVRnYL6UEg== X-Received: by 2002:a17:907:2d2c:b0:add:ede0:b9d4 with SMTP id a640c23a62f3a-af93fd76ffamr1568967066b.0.1754411530898; Tue, 05 Aug 2025 09:32:10 -0700 (PDT) From: Ross Lagerwall To: Xen-devel , xen-devel@lists.xenproject.org Cc: Ross Lagerwall , "Daniel P. Smith" , =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= , Jan Beulich Subject: [PATCH 1/2] efi: Call FreePages only if needed Date: Tue, 5 Aug 2025 17:32:03 +0100 Message-ID: <20250805163204.3631483-2-ross.lagerwall@citrix.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20250805163204.3631483-1-ross.lagerwall@citrix.com> References: <20250805163204.3631483-1-ross.lagerwall@citrix.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @citrix.com) X-ZM-MESSAGEID: 1754411552418116600 Content-Type: text/plain; charset="utf-8" If the config file is builtin, cfg.addr will be zero but Xen unconditionally calls FreePages() on the address. Xen may also call FreePages() with a zero address if blexit() is called after this point since cfg.need_to_free is not set to false. The UEFI specification does not say whether calling FreePages() with a zero address is allowed so let's be cautious and use cfg.need_to_free properly. Signed-off-by: Ross Lagerwall Acked-by Daniel P. Smith Acked-by: Andrew Cooper --- xen/common/efi/boot.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/xen/common/efi/boot.c b/xen/common/efi/boot.c index 778a39cc48e6..50ff1d1bd225 100644 --- a/xen/common/efi/boot.c +++ b/xen/common/efi/boot.c @@ -1534,8 +1534,11 @@ void EFIAPI __init noreturn efi_start(EFI_HANDLE Ima= geHandle, =20 efi_arch_cfg_file_late(loaded_image, dir_handle, section.s); =20 - efi_bs->FreePages(cfg.addr, PFN_UP(cfg.size)); - cfg.addr =3D 0; + if ( cfg.need_to_free ) + { + efi_bs->FreePages(cfg.addr, PFN_UP(cfg.size)); + cfg.need_to_free =3D false; + } =20 if ( dir_handle ) dir_handle->Close(dir_handle); --=20 2.50.1