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 18BC874003C for ; Mon, 17 Jul 2023 11:15:12 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=rrJHxdnOth8uLl6OKjm4pYMntI0ft1mf4b4+ZkVcfHw=; c=relaxed/simple; d=groups.io; h=X-Received:X-Received:X-Received:X-MC-Unique:X-Received:X-Received:X-Received:Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:In-Reply-To:X-Scanned-By:X-Mimecast-Spam-Score:X-Mimecast-Originator:Precedence:List-Unsubscribe:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:X-Gm-Message-State:Content-Type:Content-Disposition; s=20140610; t=1689592511; v=1; b=km5GYD8qFLw7e0vzui4kv5v/OFvKFTWiDNYnlkS7i21tVlDefR9itWOFHsmXqQY1eVuJ5PWP txjCUZAQKVy9GEugJvBs22d/Z1hWV3BkTK0Y7IaNcE3lF63EphbG+CvKE6vLFGD9BampaiWFzwt +ItvKx92dvlkZgGV8nFjYxsA= X-Received: by 127.0.0.2 with SMTP id nFgQYY7687511xAuSBn85uVA; Mon, 17 Jul 2023 04:15:11 -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.5725.1689592510863425801 for ; Mon, 17 Jul 2023 04:15:11 -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-647-oQgDqHCvMv2RKRY16Kc0wQ-1; Mon, 17 Jul 2023 07:15:06 -0400 X-MC-Unique: oQgDqHCvMv2RKRY16Kc0wQ-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 63B21803B25; Mon, 17 Jul 2023 11:15:05 +0000 (UTC) X-Received: from sirius.home.kraxel.org (unknown [10.39.193.170]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 704C5200C0F2; Mon, 17 Jul 2023 11:15:01 +0000 (UTC) X-Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id AF57B180078D; Mon, 17 Jul 2023 13:14:54 +0200 (CEST) Date: Mon, 17 Jul 2023 13:14:54 +0200 From: "Gerd Hoffmann" To: Taylor Beebe Cc: devel@edk2.groups.io, Jian J Wang , Liming Gao , Dandan Bi , Ard Biesheuvel , Jiewen Yao , Jordan Justen , Leif Lindholm , Sami Mujawar , Andrew Fish , Ray Ni , Eric Dong , Rahul Kumar , Guo Dong , Sean Rhodes , James Lu , Gua Guo Subject: Re: [edk2-devel] [PATCH 00/14] Implement Dynamic Memory Protections Message-ID: References: <7cc0ebd1-c847-d98e-68fc-5cb46d71969e@taylorbeebe.com> MIME-Version: 1.0 In-Reply-To: <7cc0ebd1-c847-d98e-68fc-5cb46d71969e@taylorbeebe.com> 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: RLv8wu2jTj02dkIVQNSUfWLwx7686176AA= 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=20140610 header.b=km5GYD8q; 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 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io Hi, > > Can we have both? > > > > Being able to adjust settings at runtime is great. But being able to > > set them at compile time on the command line (via build --pcd), without > > patching code, is very useful too. > > > > I'd suggest to keep the PCDs, create a profile from PCD settings and use > > that profile by default. At least for the transition phase and while we > > don't have good support (yet) to actually manage profiles. > > Hey, Gerd. > > The idea to keep PCDs around as another method of configuring protections is > good, but I don't think there would be a way to tell if a zero-ed PCD value > was an explicit setting or just the default without adding another PCD to > indicate which value should be used. I think if the HOB is produced by the > platform those settings should be used by default. Is that what you're > envisioning as well? See below, I'll come back to that in a moment. > > Speaking of profile management: What is the longer-term vision here? > There are lots of ways OEMs might want to configure their platform security > and I think it's an open question what sorts of profile management tools > would be useful to add to EDK2. I think it makes sense to have the concept of named profiles in edk2. Right now there are a bunch of #defines with profiles, I think it would be nice to have names and descriptions attached to them. Could be as simple as an array in the library: struct { CHAR16 *Name; CHAR16 *Description; DXE_MEMORY_PROTECTION_SETTINGS Settings; } MemoryProtectionProfiles[] = { { .Name = "debug", .Description = "development profile", .Settings = DXE_MEMORY_PROTECTION_SETTINGS_DEBUG, },{ /* ... */ } } Platforms could just loop over the list and add the profiles to the platform configuration menu in uefi firmware settings. Maybe it makes sense to have a MemoryProtectionConfigDxe instead so platforms can easily share the Hii code for that. One of the profiles could be created from PCDs: { .Name = "pcd", .Description = "legacy PCD based settings", .Settings.PoolGuard = PcdGetU32(PcdHeapGuardPoolType), /* ... */ } > > For virtual machine firmware it a good idea to allow picking up the > > profile configuration from the host. For qemu that can use fw_cfg, > > similar to the PcdSetNxForStack option we have today. > > I don't have much experience using the fw_cfg so I'd need to look into the > details, but would it make sense to expand the options which can be passed > via fw_cfg to be the gamut of memory protection configuration settings? I think being able to select a named profile is good enough, for example this way: qemu -fw_cfg name=opt/org.tianocore/MemoryProtectionProfile,string=debug > > > This patch series also increases the memory protection level for OvmfPkg and > > > ArmVirtPkg. > > > > Not a good idea, especially not using the 'debug' profile (which turns > > on all guard bits) because that slows down firmware boot alot. > > I haven't done performance testing, but I don't notice much slowdown. Page guard isn't much of a problem. Heap guard has significant overhead in both performance and memory usage. > Isn't development the primary use case for these virtual platforms? Development is surely one important use case Linux-based VM hosting often runs OVMF in production though. > Is there > another profile you think would work better? "pcd" (or "production") would IMHO be a better default. thanks & take care, Gerd -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#106963): https://edk2.groups.io/g/devel/message/106963 Mute This Topic: https://groups.io/mt/100090629/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-