diff options
author | Suzanne Candanedo <suzanne.candanedo@arm.com> | 2022-10-06 14:08:52 +0100 |
---|---|---|
committer | Jack Diver <diverj@google.com> | 2022-10-07 11:24:36 +0000 |
commit | 48ab9bf5fc5f938816b416a121a84128fabb4d5b (patch) | |
tree | 0ce6b45afad3674804a0aafddf2c9200120567ba /mali_pixel | |
parent | 55f1819bd982ca824ee16d19c6d2aa1bbc0ea706 (diff) | |
download | gpu-48ab9bf5fc5f938816b416a121a84128fabb4d5b.tar.gz |
mali_kbase: MIDCET-4220 Patch for GPUSWERRATA-1420
This patch is a fix for:
- SW Errata: 2712858
- CVE: CVE-2022-36449
It excludes MMU dumping and invalidates PGD
before free. For this fix to work, GPUCORE-32152
is needed which adds hooks for physical address
translation.
Bug: 251397485
Provenance: https://code.ipdelivery.arm.com/c/GPU/mali-ddk/+/4607/1
Signed-off-by: Jack Diver <diverj@google.com>
Change-Id: I9d3718b57199b7e66a5b49730ac32c810a1fc9c9
Diffstat (limited to 'mali_pixel')
-rw-r--r-- | mali_pixel/memory_group_manager.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/mali_pixel/memory_group_manager.c b/mali_pixel/memory_group_manager.c index d702b3e..faa414e 100644 --- a/mali_pixel/memory_group_manager.c +++ b/mali_pixel/memory_group_manager.c @@ -578,6 +578,32 @@ static u64 mgm_update_gpu_pte( return pte; } +static u64 mgm_pte_to_original_pte(struct memory_group_manager_device *mgm_dev, int group_id, + int mmu_level, u64 pte) +{ + struct mgm_groups *const data = mgm_dev->data; + u64 old_pte; + + if (INVALID_GROUP_ID(group_id)) + return pte; + + switch (group_id) { + case MGM_RESERVED_GROUP_ID: + case MGM_IMPORTED_MEMORY_GROUP_ID: + /* The reserved group doesn't set PBHA bits */ + /* TODO: Determine what to do with imported memory */ + break; + default: + /* All other groups will have PBHA bits, so clear them */ + old_pte = pte; + pte &= ~((u64)PBHA_BIT_MASK << PBHA_BIT_POS); + dev_dbg(data->dev, "%s: group_id=%d pte=0x%llx -> 0x%llx\n", __func__, group_id, + old_pte, pte); + } + + return pte; +} + static vm_fault_t mgm_vmf_insert_pfn_prot( struct memory_group_manager_device *const mgm_dev, int const group_id, struct vm_area_struct *const vma, unsigned long const addr, @@ -725,6 +751,7 @@ static int memory_group_manager_probe(struct platform_device *pdev) mgm_get_import_memory_id; mgm_dev->ops.mgm_vmf_insert_pfn_prot = mgm_vmf_insert_pfn_prot; mgm_dev->ops.mgm_update_gpu_pte = mgm_update_gpu_pte; + mgm_dev->ops.mgm_pte_to_original_pte = mgm_pte_to_original_pte; mgm_data = kzalloc(sizeof(*mgm_data), GFP_KERNEL); if (!mgm_data) { |