From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail05.groups.io (mail05.groups.io [45.79.224.7]) by spool.mail.gandi.net (Postfix) with ESMTPS id 9594CAC0D53 for ; Tue, 23 Apr 2024 09:25:35 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=fwVkqB/vaU2dkQGl27VBnMP5a2Tn3VmYB2BHSoLLKkY=; c=relaxed/simple; d=groups.io; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:In-Reply-To:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Resent-Date:Resent-From:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Type:Content-Disposition; s=20240206; t=1713864334; v=1; b=c8egKFYesRQqDBRgAAOcfet5o9TlHc4v0X+S3nYcOEPQisjou3TWABRbfq/kVi0SNeHR+oWZ 6u9Zto9Yhze6flFauxQ9W/IY9pguHnfcuQw+hbAkIVC6C9uQiIHWpu8utn70Bxj4+im2qOCBc4N D94pqegp25MDPeQCDoQqfo+73JRyCoJfeEZY2LC2yEGDLVFVvitAXv+7bjoS0gme9eU5xvwbZGm fxTMKp3ycdvQCMZ6JkcS0eQn2aaf4Y02sgXrWM9BlStOTp9EGz984RCh6uTjdxt0omQZnwNcq9e sHwitpcdOwCZcJGl5f6KlzAq180heLBvGGAStN4iqrgqg== X-Received: by 127.0.0.2 with SMTP id D4GFYY7687511xDeISDdKN1T; Tue, 23 Apr 2024 02:25:34 -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.web10.14333.1713864333062139251 for ; Tue, 23 Apr 2024 02:25:33 -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-662-U765y7DEM6yY96lk13s1xA-1; Tue, 23 Apr 2024 05:25:30 -0400 X-MC-Unique: U765y7DEM6yY96lk13s1xA-1 X-Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (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 251F48021A5; Tue, 23 Apr 2024 09:25:30 +0000 (UTC) X-Received: from sirius.home.kraxel.org (unknown [10.39.192.150]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DE638402482D; Tue, 23 Apr 2024 09:25:29 +0000 (UTC) X-Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id A789B1800DF0; Tue, 23 Apr 2024 11:25:28 +0200 (CEST) Date: Tue, 23 Apr 2024 11:25:28 +0200 From: "Gerd Hoffmann" To: Jiaxin Wu Cc: devel@edk2.groups.io, Ard Biesheuvel , Jiewen Yao , Ray Ni Subject: Re: [edk2-devel] [PATCH v3 08/13] OvmfPkg/PlatformInitLib: Create gEfiSmmSmramMemoryGuid Message-ID: References: <20240418065556.5696-1-jiaxin.wu@intel.com> <20240418065556.5696-9-jiaxin.wu@intel.com> MIME-Version: 1.0 In-Reply-To: <20240418065556.5696-9-jiaxin.wu@intel.com> X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.2 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 Resent-Date: Tue, 23 Apr 2024 02:25:33 -0700 Resent-From: kraxel@redhat.com Reply-To: devel@edk2.groups.io,kraxel@redhat.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: fbwHgYG8Nh1239SxYvBzFz5Ex7686176AA= Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20240206 header.b=c8egKFYe; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=redhat.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 45.79.224.7 as permitted sender) smtp.mailfrom=bounce@groups.io Hi, > + Hob.Raw = BuildGuidHob ( > + &gEfiSmmSmramMemoryGuid, > + BufferSize > + ); > + SmramHobDescriptorBlock = (EFI_SMRAM_HOB_DESCRIPTOR_BLOCK *)(Hob.Raw); > + SmramHobDescriptorBlock->Descriptor[0].PhysicalStart = PlatformInfoHob->LowMemory - TsegSize; > + SmramHobDescriptorBlock->Descriptor[0].CpuStart = PlatformInfoHob->LowMemory - TsegSize; > + SmramHobDescriptorBlock->Descriptor[0].PhysicalSize = EFI_PAGE_SIZE; > + SmramHobDescriptorBlock->Descriptor[0].RegionState = EFI_SMRAM_CLOSED | EFI_CACHEABLE | EFI_ALLOCATED; > + SmramHobDescriptorBlock->Descriptor[1].PhysicalStart = SmramHobDescriptorBlock->Descriptor[0].PhysicalStart + EFI_PAGE_SIZE; > + SmramHobDescriptorBlock->Descriptor[1].CpuStart = SmramHobDescriptorBlock->Descriptor[0].CpuStart + EFI_PAGE_SIZE; > + SmramHobDescriptorBlock->Descriptor[1].PhysicalSize = TsegSize - EFI_PAGE_SIZE; > + SmramHobDescriptorBlock->Descriptor[1].RegionState = EFI_SMRAM_CLOSED | EFI_CACHEABLE; This is not going to fly. First, smram allocation doesn't work that way. Have a look at OvmfPkg/SmmAccess. I guess that easily explains why this series breaks S3 suspend. Second, storing these descriptors in a HOB (which is PEI memory) is questionable from a security point of view. take care, Gerd -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#118131): https://edk2.groups.io/g/devel/message/118131 Mute This Topic: https://groups.io/mt/105593577/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-