From nobody Thu May 9 07:38:44 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+94042+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+94042+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1663738254; cv=none; d=zohomail.com; s=zohoarc; b=XRWLEi7SZ637VXIO/dFlaAmGtX1SGtfhzmxYTdx66v0/VbAM8MQYpyphxKpDeEaDY4LHQ9z6niLW+oCqMDD1MvJksOcvIGqwvq2qmG2/irEYjRy7UDggB16uukbr3JjWkgrH5RX0WmpTXMZFxPtpl6LJ1m+54Ragl/A2Zsf+M2A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1663738254; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=uA/kkJtQbLYn6TWdHHy+OwGOWsGieSOI8izW3766j7o=; b=SQlZz1j3xmxOjxMHaeRWr8uWLeSx6YHz7OL/o2AiB43nIQp6l/cXn0sfJVkuWVqhp+JB5hgfu4FDPYc1IPcr4iCEDRTnw+MEXsx7ss39zyP0XiQKFrAH6y9r1jlXtKnZ1MlcKD2RG5EytsdhPefQkQ/+w9SfdhOMlFtFUF+8pE0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+94042+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 16637382541691017.8201062770222; Tue, 20 Sep 2022 22:30:54 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id TyxWYY1788612xIbX70l4EyU; Tue, 20 Sep 2022 22:30:53 -0700 X-Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.groups.io with SMTP id smtpd.web12.3098.1663738252798249109 for ; Tue, 20 Sep 2022 22:30:53 -0700 X-Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-22-RnsvG14nPcS0Qdd-n6aZkA-1; Wed, 21 Sep 2022 01:30:47 -0400 X-MC-Unique: RnsvG14nPcS0Qdd-n6aZkA-1 X-Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6F0CF811E67; Wed, 21 Sep 2022 05:30:47 +0000 (UTC) X-Received: from sirius.home.kraxel.org (unknown [10.39.192.24]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 243AC2024CB7; Wed, 21 Sep 2022 05:30:47 +0000 (UTC) X-Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 2911918000A9; Wed, 21 Sep 2022 07:30:45 +0200 (CEST) From: "Gerd Hoffmann" To: devel@edk2.groups.io Cc: Jordan Justen , Gerd Hoffmann , Oliver Steffen , Ard Biesheuvel , Pawel Polawski , Jiewen Yao Subject: [edk2-devel] [PATCH 1/2] OvmfPkg/QemuBootOrderLib: allow slash in rom filenames Date: Wed, 21 Sep 2022 07:30:44 +0200 Message-Id: <20220921053045.92473-2-kraxel@redhat.com> In-Reply-To: <20220921053045.92473-1-kraxel@redhat.com> References: <20220921053045.92473-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,kraxel@redhat.com X-Gm-Message-State: envmiRHZGHb13gUl2VnsAiCax1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1663738253; bh=8LQm9RlBRZYDztQXlec1rFMDprC8Bd9eyxkcv771Bxw=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=L9bbr9pSgtZ4czhD638XbnzbrJXBNe0yOQerII+siGp5SPytj0k/n7SMJ8NtB2eo8uW KhTWTt5NyNyw5Ro5RfH/vMapqKhuotC5CtieFGqUoLzvI39xKsQShOv5Xy0y+We6frIgU QmsY4dHL596hNPuqb5qrvVz0EDheeH4LWyw= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1663738256175100009 Content-Type: text/plain; charset="utf-8"; x-default="true" See comment for details. Needed to avoid the parser abort, so we can continue parsing the bootorder fw_cfg file. Signed-off-by: Gerd Hoffmann Reviewed-by: Ard Biesheuvel --- .../QemuBootOrderLib/QemuBootOrderLib.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.c b/OvmfPkg/= Library/QemuBootOrderLib/QemuBootOrderLib.c index 398de7fab4ba..374c6d8f5e91 100644 --- a/OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.c +++ b/OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.c @@ -432,6 +432,8 @@ ParseOfwNode ( OUT BOOLEAN *IsFinal ) { + BOOLEAN AcceptSlash =3D FALSE; + // // A leading slash is expected. End of string is tolerated. // @@ -464,6 +466,21 @@ ParseOfwNode ( return RETURN_INVALID_PARAMETER; } =20 + if (SubstringEq (OfwNode->DriverName, "rom")) { + // + // bug compatibility hack + // + // qemu passes fw_cfg filenames as rom unit address. + // The filenames have slashes: + // /rom@genroms/linuxboot_dma.bin + // + // Alow slashes in the unit address to avoid the parser trip up, + // so we can successfully parse the following lines (the rom + // entries themself are ignored). + // + AcceptSlash =3D TRUE; + } + // // unit-address // @@ -475,7 +492,7 @@ ParseOfwNode ( =20 OfwNode->UnitAddress.Ptr =3D *Ptr; OfwNode->UnitAddress.Len =3D 0; - while (IsPrintNotDelim (**Ptr)) { + while (IsPrintNotDelim (**Ptr) || (AcceptSlash && **Ptr =3D=3D '/')) { ++*Ptr; ++OfwNode->UnitAddress.Len; } --=20 2.37.3 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#94042): https://edk2.groups.io/g/devel/message/94042 Mute This Topic: https://groups.io/mt/93820837/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Thu May 9 07:38:44 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+94041+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+94041+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1663738253; cv=none; d=zohomail.com; s=zohoarc; b=nHFF9gLhiO8nuX4SH6BSE6tkwTfynpLjQAPyh+bJ9TasPAIojTr1zWEkHc59vwqlOJScKKYRrg/3AOvlUG5x8obRoIeHDpJMMRji4MmlU4S0iW0WwcDmJPM9k/Zvh7RVz12fsNJSchNxL8TUTSYpwn3Lq4mYLAcTVxvaq/B6OuI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1663738253; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=ipbze9+ANBwBkky5J6g87phjJvwOnFpGwzyUDbMYsI8=; b=JH29PnI1Ueh6eyeBcf8jNRCq9C8zn/gsw0+fPUvUHdMscRWPsUR4KBJlpXqJK/5wnscxbN8Fyyiwdqkk7kT9ov/5LNSBPAxxBJKrUL/FKkKdKK89jkigyMm+g+OLG2tNY571s3nShq6O/WmZkH8PLwdeVtCQ5uXx25lBgWVRSdo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+94041+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1663738253784106.26735393051888; Tue, 20 Sep 2022 22:30:53 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id S2MRYY1788612xHaxUDHpAeP; Tue, 20 Sep 2022 22:30:53 -0700 X-Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.groups.io with SMTP id smtpd.web11.3103.1663738252293285354 for ; Tue, 20 Sep 2022 22:30:52 -0700 X-Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-78-G45i8KgwObiebIs4c2ZuWA-1; Wed, 21 Sep 2022 01:30:49 -0400 X-MC-Unique: G45i8KgwObiebIs4c2ZuWA-1 X-Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 00436811726; Wed, 21 Sep 2022 05:30:49 +0000 (UTC) X-Received: from sirius.home.kraxel.org (unknown [10.39.192.24]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BBFF81759F; Wed, 21 Sep 2022 05:30:48 +0000 (UTC) X-Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 3256C180039B; Wed, 21 Sep 2022 07:30:45 +0200 (CEST) From: "Gerd Hoffmann" To: devel@edk2.groups.io Cc: Jordan Justen , Gerd Hoffmann , Oliver Steffen , Ard Biesheuvel , Pawel Polawski , Jiewen Yao Subject: [edk2-devel] [PATCH 2/2] OvmfPkg/QemuBootOrderLib: skip over unsupported entries in StoreQemuBootOrder Date: Wed, 21 Sep 2022 07:30:45 +0200 Message-Id: <20220921053045.92473-3-kraxel@redhat.com> In-Reply-To: <20220921053045.92473-1-kraxel@redhat.com> References: <20220921053045.92473-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,kraxel@redhat.com X-Gm-Message-State: kEU7tSycBQaCNbWJFzk9xhPEx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1663738253; bh=9R0W8iuIm5AzCxVOEshNHF67l1Q/jmcWgOgmVr1CS9g=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=uwVQtRY4ZQCJcLP0+AchdBsKFrnan5toG9gWavVAP+swoV2yjJC/IK5XaMQ1t6qOEFP VTREklUxYB7o50YL9bEMs0nKPDTCkZnaZPdxINSCWM8ZOlne8b+Y1SpIgbSay8s902Fe5 nOvqA1reVfv8nZgJcV4u0yuEY5PA2mEhnkk= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1663738254196100002 Content-Type: text/plain; charset="utf-8"; x-default="true" When finding an unsupported entry just skip over and continue with the next entry instead of stop processing altogether. Signed-off-by: Gerd Hoffmann Reviewed-by: Ard Biesheuvel --- .../QemuBootOrderLib/QemuBootOrderLib.c | 56 ++++++++++--------- 1 file changed, 30 insertions(+), 26 deletions(-) diff --git a/OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.c b/OvmfPkg/= Library/QemuBootOrderLib/QemuBootOrderLib.c index 374c6d8f5e91..18646daa67e3 100644 --- a/OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.c +++ b/OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.c @@ -1775,35 +1775,39 @@ StoreQemuBootOrder ( Translated, &TranslatedSize ); - while (!RETURN_ERROR (Status)) { - EFI_DEVICE_PATH_PROTOCOL *DevicePath; + while (Status =3D=3D EFI_SUCCESS || + Status =3D=3D EFI_UNSUPPORTED) + { + if (Status =3D=3D EFI_SUCCESS) { + EFI_DEVICE_PATH_PROTOCOL *DevicePath; =20 - // - // Convert the UEFI devpath prefix to binary representation. - // - ASSERT (Translated[TranslatedSize] =3D=3D L'\0'); - DevicePath =3D ConvertTextToDevicePath (Translated); - if (DevicePath =3D=3D NULL) { - Status =3D RETURN_OUT_OF_RESOURCES; - goto FreeExtraPciRoots; + // + // Convert the UEFI devpath prefix to binary representation. + // + ASSERT (Translated[TranslatedSize] =3D=3D L'\0'); + DevicePath =3D ConvertTextToDevicePath (Translated); + if (DevicePath =3D=3D NULL) { + Status =3D RETURN_OUT_OF_RESOURCES; + goto FreeExtraPciRoots; + } + + UnicodeSPrint ( + VariableName, + sizeof (VariableName), + L"QemuBootOrder%04d", + VariableIndex++ + ); + DEBUG ((DEBUG_INFO, "%a: %s =3D %s\n", __FUNCTION__, VariableName, T= ranslated)); + gRT->SetVariable ( + VariableName, + &gQemuBootOrderGuid, + EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS, + GetDevicePathSize (DevicePath), + DevicePath + ); + FreePool (DevicePath); } =20 - UnicodeSPrint ( - VariableName, - sizeof (VariableName), - L"QemuBootOrder%04d", - VariableIndex++ - ); - DEBUG ((DEBUG_INFO, "%a: %s =3D %s\n", __FUNCTION__, VariableName, Tra= nslated)); - gRT->SetVariable ( - VariableName, - &gQemuBootOrderGuid, - EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS, - GetDevicePathSize (DevicePath), - DevicePath - ); - FreePool (DevicePath); - // // Move to the next OFW devpath. // --=20 2.37.3 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#94041): https://edk2.groups.io/g/devel/message/94041 Mute This Topic: https://groups.io/mt/93820836/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-