From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id BD403D8042B for ; Mon, 30 Oct 2023 12:54:45 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=ItPJWKQtL8cju1W9Pe/AF8mSKr33YgLCYZbPauW/+OM=; c=relaxed/simple; d=groups.io; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From:In-Reply-To:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Language:Content-Type:Content-Transfer-Encoding; s=20140610; t=1698670484; v=1; b=dJH224+K9sdHUc+Zh4g5aTcbYVlWS1c9eKyBCEMIsEzVUt5p5eiV3rOa3ARDkfbbSoJ97ouz zEqF1olZcmIQfN88iWgPzS7INdMwbaSj+fCan4iAAr4GrLiE3Kl2icOigr/l2uF4ZUQ+/GrV0zi j4BsJcCAh3X1lqgADBr6hTqs= X-Received: by 127.0.0.2 with SMTP id ASsgYY7687511xrPBtZBdmh4; Mon, 30 Oct 2023 05:54:44 -0700 X-Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.groups.io with SMTP id smtpd.web11.148070.1698670483501408794 for ; Mon, 30 Oct 2023 05:54:43 -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.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-287-suXpYzQDPiiwWIGmIA5R5Q-1; Mon, 30 Oct 2023 08:54:40 -0400 X-MC-Unique: suXpYzQDPiiwWIGmIA5R5Q-1 X-Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id BFF1B8724A6; Mon, 30 Oct 2023 12:54:39 +0000 (UTC) X-Received: from [10.39.194.199] (unknown [10.39.194.199]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D9E781121306; Mon, 30 Oct 2023 12:54:38 +0000 (UTC) Message-ID: Date: Mon, 30 Oct 2023 13:54:37 +0100 MIME-Version: 1.0 Subject: Re: [edk2-devel] [PATCH v3 4/4] StandaloneMmPkg/Core: Fix the failure to find uncompressed inner FV To: Wei6 Xu , devel@edk2.groups.io Cc: Ard Biesheuvel , Sami Mujawar , Ray Ni References: <0936c14a0495947f318724e50169b4161cae7c72.1698651605.git.wei6.xu@intel.com> From: "Laszlo Ersek" In-Reply-To: <0936c14a0495947f318724e50169b4161cae7c72.1698651605.git.wei6.xu@intel.com> X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Precedence: Bulk 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,lersek@redhat.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: aZMUcD1y6zQN06RPtjMraZ0Vx7686176AA= Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=dJH224+K; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=redhat.com (policy=none) On 10/30/23 08:49, Wei6 Xu wrote: > The MmCoreFfsFindMmDriver only checks for encapsulated compressed FVs. > When an inner FV is uncompressed, StandaloneMmCore will miss the FV and > all the MM drivers in the FV will not be dispatched. > Add checks for uncompressed inner FV to fix this issue. >=20 > Cc: Laszlo Ersek > Cc: Ard Biesheuvel > Cc: Sami Mujawar > Cc: Ray Ni > Signed-off-by: Wei6 Xu > --- > StandaloneMmPkg/Core/FwVol.c | 19 +++++++++++++++++++ > 1 file changed, 19 insertions(+) >=20 > diff --git a/StandaloneMmPkg/Core/FwVol.c b/StandaloneMmPkg/Core/FwVol.c > index fa335d62c252..783dbaf9b048 100644 > --- a/StandaloneMmPkg/Core/FwVol.c > +++ b/StandaloneMmPkg/Core/FwVol.c > @@ -116,6 +116,25 @@ MmCoreFfsFindMmDriver ( > break; > } > =20 > + // > + // Check uncompressed firmware volumes > + // > + Status =3D FfsFindSectionData ( > + EFI_SECTION_FIRMWARE_VOLUME_IMAGE, > + FileHeader, > + &SectionData, > + &SectionDataSize > + ); > + if (!EFI_ERROR (Status)) { > + if (SectionDataSize > sizeof (EFI_FIRMWARE_VOLUME_HEADER)) { > + InnerFvHeader =3D (EFI_FIRMWARE_VOLUME_HEADER *)SectionData; > + MmCoreFfsFindMmDriver (InnerFvHeader, Depth + 1); > + } > + } > + > + // > + // Check compressed firmware volumes > + // > Status =3D FfsFindSection ( > EFI_SECTION_GUID_DEFINED, > FileHeader, (1) In case we find an EFI_SECTION_FIRMWARE_VOLUME_IMAGE, do we still want = to look for an EFI_SECTION_GUID_DEFINED? I think that's quite unlikely. If you agree, can you add a "continue" right= after the new MmCoreFfsFindMmDriver() call? Reviewed-by: Laszlo Ersek (2) We have a separate "InnerFvHeader" assignment, near the bottom of this = (first) loop in the function: Status =3D FindFfsSectionInSections ( DstBuffer, DstBufferSize, EFI_SECTION_FIRMWARE_VOLUME_IMAGE, &Section ); if (EFI_ERROR (Status)) { goto FreeDstBuffer; } =20 InnerFvHeader =3D (VOID *)(Section + 1); Status =3D MmCoreFfsFindMmDriver (InnerFvHeader, Depth + 1); That doesn't look right to me; what if Section in fact points to an EFI_COM= MON_SECTION_HEADER2? FfsFindSectionData() handles this internally; it checks IS_SECTION2(), and = then adjusts SectionData accordingly: if (IS_SECTION2 (Section)) { *SectionData =3D (VOID *)((EFI_COMMON_SECTION_HEADER2 *)Section= + 1); ... } else { *SectionData =3D (VOID *)(Section + 1); ... } I think we need to set InnerFvHeader similarly, here. Can you please append= a separate patch for fixing that? Thanks! Laszlo -=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 (#110316): https://edk2.groups.io/g/devel/message/110316 Mute This Topic: https://groups.io/mt/102270549/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/leave/12367111/7686176/19134562= 12/xyzzy [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-