From mboxrd@z Thu Jan 1 00:00:00 1970 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 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=ZJycWRQj; spf=pass (domain: redhat.com, ip: 170.10.133.124, mailfrom: kraxel@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1663738251; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9aWTSpD9AgNBqu7BRP5sfT8Gs1umrCO1MqPU4m6gaW0=; b=ZJycWRQjXsECgKA44qeLH5Iuu/mew5vuNCKUFAzAvmKkk+8v633f5AJErhlBKUedJSqAs+ OY90wX+D4wcGpZzotWr3Q2hKMsbMKLA7t6DnBXXP5dSih++osbd1t/y4w1V8WL7lHFDJYq L91uVGsr5JyShUtLBjitfh4RIzh+s1E= 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 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) 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) 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: [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 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; 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 --- .../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 = FALSE; + // // A leading slash is expected. End of string is tolerated. // @@ -464,6 +466,21 @@ ParseOfwNode ( return RETURN_INVALID_PARAMETER; } + 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 = TRUE; + } + // // unit-address // @@ -475,7 +492,7 @@ ParseOfwNode ( OfwNode->UnitAddress.Ptr = *Ptr; OfwNode->UnitAddress.Len = 0; - while (IsPrintNotDelim (**Ptr)) { + while (IsPrintNotDelim (**Ptr) || (AcceptSlash && **Ptr == '/')) { ++*Ptr; ++OfwNode->UnitAddress.Len; } -- 2.37.3