From nobody Mon Sep 16 19:25:20 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+101128+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+101128+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=kernel.org ARC-Seal: i=1; a=rsa-sha256; t=1678727920; cv=none; d=zohomail.com; s=zohoarc; b=QzPQqG9vratf/E81yrL2RuRnkqF9Mqch+0NYzhTADpnamDaur8k/NOoFqfDV3Cd+p8DqVHJgXSEXOOuoqRgT5Uybjrs7NtK3JQM36Kvrbw6VK/Do+giXVUFR0KY5CmdeiNishpYMnklaKv4Zm596dk0qP5B/GHZcLH6izjglXXc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1678727920; h=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=3oEcE1lbTfewETFmcX5WHwdWvCG8XmXCAgMYe0hKvqw=; b=OS5Yw2MetWC7yclG/WFwFO91EWYlSY5mrGkxme+xX4C61qMhDFBopsK1ZlQbyqeNrHw+jSJ9mlES300lRGH4la/QSXAgbL28v4wajuuWI5TDCxN2phkFB2NZk38SHlRNSV4KMFEHJwUq1Tv/ibf9uyQWG5GVyZB8hJTZ1PgdEvU= 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+101128+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 167872792039094.20385332475928; Mon, 13 Mar 2023 10:18:40 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id B8rvYY1788612xVlAY0BWLBT; Mon, 13 Mar 2023 10:18:40 -0700 X-Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by mx.groups.io with SMTP id smtpd.web11.26501.1678727918179369115 for ; Mon, 13 Mar 2023 10:18:38 -0700 X-Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9613C61314; Mon, 13 Mar 2023 17:18:37 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id CE0D7C433A1; Mon, 13 Mar 2023 17:18:34 +0000 (UTC) From: "Ard Biesheuvel" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Michael Kinney , Liming Gao , Jiewen Yao , Michael Kubacki , Sean Brogan , Rebecca Cran , Leif Lindholm , Sami Mujawar , Taylor Beebe Subject: [edk2-devel] [PATCH v5 24/38] ArmVirtPkg/ArmVirtQemu: Use XP memory mappings by default Date: Mon, 13 Mar 2023 18:17:00 +0100 Message-Id: <20230313171714.3866151-25-ardb@kernel.org> In-Reply-To: <20230313171714.3866151-1-ardb@kernel.org> References: <20230313171714.3866151-1-ardb@kernel.org> MIME-Version: 1.0 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,ardb@kernel.org X-Gm-Message-State: eFNC9flHgpR9GfcHsvFcjWyUx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1678727920; bh=St2Rake0i1UJKEm4mi7biE+802AoSe2Rp8NQS0hYukQ=; h=Cc:Date:From:Reply-To:Subject:To; b=YZM1PZvQD7WAZ3c3l8kaIWfaeiYVh7uaetiD6vuqKiRETDJj7J9ongXpyXT/6fHuBpF h+LgkwgA3o/ZgOv5341pQjM4qqP2e4XwBLExSz/SW3oC20rGw17TlXosvPtoz/1H2Zvg/ nxB1mzBODT+jvMSHDW3WMjd+kD8OqHiBkeQ= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1678727922305100001 Content-Type: text/plain; charset="utf-8" Now that all the plumbing is in place, we can switch to a default policy of XP for all memory mappings straight out of reset. This reduces the risk of running with memory ranges mapped as both writable and executable at the same time. Note this this requires the overlay library to be added to the DXE core, as otherwise, it will not be able to dispatch the CPU arch protocol DXE driver (or any other DXE driver for that matter), as it would lack the ability to grant executable permissions to those executables. Signed-off-by: Ard Biesheuvel --- ArmVirtPkg/ArmVirtQemu.dsc | 1 + ArmVirtPkg/ArmVirtQemuKernel.dsc | 1 + ArmVirtPkg/Library/QemuVirtMemInfoLib/QemuVirtMemInfoLib.c | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/ArmVirtPkg/ArmVirtQemu.dsc b/ArmVirtPkg/ArmVirtQemu.dsc index 72a0cacab4a8..b9c244f16e04 100644 --- a/ArmVirtPkg/ArmVirtQemu.dsc +++ b/ArmVirtPkg/ArmVirtQemu.dsc @@ -372,6 +372,7 @@ [Components.common] # MdeModulePkg/Core/Dxe/DxeMain.inf { + NULL|ArmPkg/Library/ArmSetMemoryOverrideLib/ArmSetMemoryOverrideLib.= inf NULL|MdeModulePkg/Library/DxeCrc32GuidedSectionExtractLib/DxeCrc32Gu= idedSectionExtractLib.inf DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf } diff --git a/ArmVirtPkg/ArmVirtQemuKernel.dsc b/ArmVirtPkg/ArmVirtQemuKerne= l.dsc index 3cb9120e4e10..c09755e6e1b9 100644 --- a/ArmVirtPkg/ArmVirtQemuKernel.dsc +++ b/ArmVirtPkg/ArmVirtQemuKernel.dsc @@ -278,6 +278,7 @@ [Components.common] # MdeModulePkg/Core/Dxe/DxeMain.inf { + NULL|ArmPkg/Library/ArmSetMemoryOverrideLib/ArmSetMemoryOverrideLib.= inf NULL|MdeModulePkg/Library/DxeCrc32GuidedSectionExtractLib/DxeCrc32Gu= idedSectionExtractLib.inf DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf } diff --git a/ArmVirtPkg/Library/QemuVirtMemInfoLib/QemuVirtMemInfoLib.c b/A= rmVirtPkg/Library/QemuVirtMemInfoLib/QemuVirtMemInfoLib.c index 9cf43f06c073..aa083cec2082 100644 --- a/ArmVirtPkg/Library/QemuVirtMemInfoLib/QemuVirtMemInfoLib.c +++ b/ArmVirtPkg/Library/QemuVirtMemInfoLib/QemuVirtMemInfoLib.c @@ -91,7 +91,7 @@ ArmVirtGetMemoryMap ( VirtualMemoryTable[0].PhysicalBase =3D PcdGet64 (PcdSystemMemoryBase); VirtualMemoryTable[0].VirtualBase =3D VirtualMemoryTable[0].PhysicalBas= e; VirtualMemoryTable[0].Length =3D *(UINT64 *)GET_GUID_HOB_DATA (Mem= orySizeHob); - VirtualMemoryTable[0].Attributes =3D ARM_MEMORY_REGION_ATTRIBUTE_WRITE= _BACK; + VirtualMemoryTable[0].Attributes =3D ARM_MEMORY_REGION_ATTRIBUTE_WRITE= _BACK_XP; =20 DEBUG (( DEBUG_INFO, --=20 2.39.2 -=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 (#101128): https://edk2.groups.io/g/devel/message/101128 Mute This Topic: https://groups.io/mt/97586029/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-