From nobody Fri Dec 19 22:06:12 2025 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 From nobody Fri Dec 19 22:06:12 2025 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=1754411554; cv=none; d=zohomail.com; s=zohoarc; b=GA5qJEb8Nd8l2TCDR6H+2xXsQnl2vQ1jZBaTx0lj4VcgbvY84vLsH8zIj64w1Zze1754FKNuDmm8VGrrYwpxwwQREZ+APTU5hGQOxIiVnixwN1W/XNV1Q8bvGYvjUv9lOkzuuc9wzaw2jzAo+JnWSdHZtTH7eC1UeRCKXxqLRLw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1754411554; 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=L1QqT35WPMNEdKVxqmbRQUpDF5jhPdPInhgcu4VmEpk=; b=GJNnTetcggR6nKxkKIrmDR19XUvFl2gFjHyKNyc3YtKTur6nHRcWhz+teTwNSzJqIS0CfMJDeOp7Ep9Rgj/76zQpIu6gprmYDtKUx9oGwSnuwbLW9yuRLEOES7b5AslkT8lqEDqdz4CK2FiUCpIyj4D5mGqVSR+/ybdCYun/tBs= 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 1754411554915656.6548185264529; Tue, 5 Aug 2025 09:32:34 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1070748.1434402 (Exim 4.92) (envelope-from ) id 1ujKaG-0003gd-6d; Tue, 05 Aug 2025 16:32:16 +0000 Received: by outflank-mailman (output) from mailman id 1070748.1434402; Tue, 05 Aug 2025 16:32:16 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ujKaG-0003gP-3C; Tue, 05 Aug 2025 16:32:16 +0000 Received: by outflank-mailman (input) for mailman id 1070748; Tue, 05 Aug 2025 16:32:14 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ujKaE-0002Yg-4b for xen-devel@lists.xen.org; Tue, 05 Aug 2025 16:32:14 +0000 Received: from mail-ej1-x630.google.com (mail-ej1-x630.google.com [2a00:1450:4864:20::630]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id bdf1b194-7219-11f0-a321-13f23c93f187; Tue, 05 Aug 2025 18:32:13 +0200 (CEST) Received: by mail-ej1-x630.google.com with SMTP id a640c23a62f3a-af922ab4849so851607166b.3 for ; Tue, 05 Aug 2025 09:32:13 -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.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Aug 2025 09:32:12 -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: bdf1b194-7219-11f0-a321-13f23c93f187 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1754411533; x=1755016333; 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=L1QqT35WPMNEdKVxqmbRQUpDF5jhPdPInhgcu4VmEpk=; b=kMtTWE3TMx3uIJAUZSpBpug1sxlsYJZN0NYrZIoUIIeclFVqzTVD3n+n+LEoa/pzdy 3aMbAMsX0T9M0iLo30S79bY3OBz39FFrdGDI0eYF3NkBxYoVuAQEBrnL06VMXFIkQiuE G1WG/ZmQD29jHiraDdZA2ZbeXQvHTBBLB3WU8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1754411533; x=1755016333; 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=L1QqT35WPMNEdKVxqmbRQ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SMTP id a640c23a62f3a-af940277761mr1288991366b.58.1754411532702; Tue, 05 Aug 2025 09:32:12 -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 2/2] efi: Stop using StdErr Date: Tue, 5 Aug 2025 17:32:04 +0100 Message-ID: <20250805163204.3631483-3-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: 1754411561422124100 Content-Type: text/plain; charset="utf-8" Xen's use of StdErr is inconsistent. Some boot errors are reported using PrintErr() which uses StdErr and some are reported using blexit() which uses StdOut. On my test system using OVMF, StdErr is not displayed on the emulated screen. Looking at other EFI applications, StdErr is just used for debug messages if at all. Therefore, switch all boot output to use StdOut. Signed-off-by: Ross Lagerwall --- xen/common/efi/boot.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/xen/common/efi/boot.c b/xen/common/efi/boot.c index 50ff1d1bd225..6ba486943466 100644 --- a/xen/common/efi/boot.c +++ b/xen/common/efi/boot.c @@ -153,7 +153,6 @@ static UINT32 __initdata efi_bs_revision; static EFI_HANDLE __initdata efi_ih; =20 static SIMPLE_TEXT_OUTPUT_INTERFACE *__initdata StdOut; -static SIMPLE_TEXT_OUTPUT_INTERFACE *__initdata StdErr; =20 static UINT32 __initdata mdesc_ver; static bool __initdata map_bs; @@ -168,11 +167,7 @@ static void __init PrintStr(const CHAR16 *s) { StdOut->OutputString(StdOut, (CHAR16 *)s ); } - -static void __init PrintErr(const CHAR16 *s) -{ - StdErr->OutputString(StdErr, (CHAR16 *)s ); -} +#define PrintErr PrintStr =20 static CHAR16 *__init FormatDec(UINT64 Val, CHAR16 *Buffer) { @@ -287,7 +282,6 @@ static bool __init match_guid(const EFI_GUID *guid1, co= nst EFI_GUID *guid2) /* generic routine for printing error messages */ static void __init noreturn PrintErrMesg(const CHAR16 *mesg, EFI_STATUS Er= rCode) { - StdOut =3D StdErr; PrintErr(mesg); PrintErr(L": "); =20 @@ -914,7 +908,6 @@ static void __init efi_init(EFI_HANDLE ImageHandle, EFI= _SYSTEM_TABLE *SystemTabl efi_fw_revision =3D SystemTable->FirmwareRevision; =20 StdOut =3D SystemTable->ConOut; - StdErr =3D SystemTable->StdErr ?: StdOut; } =20 static void __init efi_console_set_mode(void) --=20 2.50.1