Commit e7b24ec9785d ("ArmPkg/UncachedMemoryAllocationLib: map uncached allocations non-executable") adds code that manipulates the GCD memory space attributes of a newly allocated uncached region without checking whether this region expose these attributes in its capabilities mask. Given that the intent is to remove executable permissions from the region, this is a fairly pointless exercise to begin with, regardless of whether it is correct or not. The reason is that RO/XP memory attributes in the GCD memory space map or the UEFI memory map are completely disconnected from the actual mapping permissions used in the page tables. So instead, invoke the CPU arch protocol directly, and add the non-exec attributes in the page tables directly. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org> Tested-by: Ryan Harkin <ryan.harkin@linaro.org>
51 lines
1.5 KiB
INI
51 lines
1.5 KiB
INI
#/** @file
|
|
#
|
|
# UncachedMemoryAllocation lib that uses DXE Service to change cachability for
|
|
# a buffer.
|
|
#
|
|
# Copyright (c) 2008 - 2010, Apple Inc. All rights reserved.<BR>
|
|
#
|
|
# This program and the accompanying materials
|
|
# are licensed and made available under the terms and conditions of the BSD License
|
|
# which accompanies this distribution. The full text of the license may be found at
|
|
# http://opensource.org/licenses/bsd-license.php
|
|
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|
#
|
|
#
|
|
#**/
|
|
|
|
[Defines]
|
|
INF_VERSION = 0x00010005
|
|
BASE_NAME = UncachedMemoryAllocationLib
|
|
FILE_GUID = DC101A1A-7525-429B-84AF-EEAA630E576C
|
|
MODULE_TYPE = DXE_DRIVER
|
|
VERSION_STRING = 1.0
|
|
LIBRARY_CLASS = UncachedMemoryAllocationLib
|
|
CONSTRUCTOR = UncachedMemoryAllocationLibConstructor
|
|
DESTRUCTOR = UncachedMemoryAllocationLibDestructor
|
|
|
|
[Sources.common]
|
|
UncachedMemoryAllocationLib.c
|
|
|
|
[Packages]
|
|
ArmPkg/ArmPkg.dec
|
|
MdePkg/MdePkg.dec
|
|
|
|
[LibraryClasses]
|
|
BaseLib
|
|
ArmLib
|
|
MemoryAllocationLib
|
|
PcdLib
|
|
DxeServicesTableLib
|
|
CacheMaintenanceLib
|
|
|
|
[Pcd]
|
|
gArmTokenSpaceGuid.PcdArmFreeUncachedMemorySizeThreshold
|
|
|
|
[Protocols]
|
|
gEfiCpuArchProtocolGuid
|
|
|
|
[Depex]
|
|
gEfiCpuArchProtocolGuid
|