summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/qemu/qemu/CVE-2022-35414.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/qemu/qemu/CVE-2022-35414.patch')
-rw-r--r--meta/recipes-devtools/qemu/qemu/CVE-2022-35414.patch53
1 files changed, 53 insertions, 0 deletions
diff --git a/meta/recipes-devtools/qemu/qemu/CVE-2022-35414.patch b/meta/recipes-devtools/qemu/qemu/CVE-2022-35414.patch
new file mode 100644
index 0000000000..4196ebcf98
--- /dev/null
+++ b/meta/recipes-devtools/qemu/qemu/CVE-2022-35414.patch
@@ -0,0 +1,53 @@
1From 09a07b5b39c87423df9e8f6574c19a14d36beac5 Mon Sep 17 00:00:00 2001
2From: Hitendra Prajapati <hprajapati@mvista.com>
3Date: Wed, 27 Jul 2022 10:34:12 +0530
4Subject: [PATCH] CVE-2022-35414
5
6Upstream-Status: Backport [https://github.com/qemu/qemu/commit/418ade7849ce7641c0f7333718caf5091a02fd4c]
7CVE: CVE-2022-35414
8Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com>
9---
10 exec.c | 13 ++++++++++++-
11 1 file changed, 12 insertions(+), 1 deletion(-)
12
13diff --git a/exec.c b/exec.c
14index 43c70ffb..2d6add46 100644
15--- a/exec.c
16+++ b/exec.c
17@@ -685,7 +685,7 @@ static void tcg_iommu_free_notifier_list(CPUState *cpu)
18
19 /* Called from RCU critical section */
20 MemoryRegionSection *
21-address_space_translate_for_iotlb(CPUState *cpu, int asidx, hwaddr addr,
22+address_space_translate_for_iotlb(CPUState *cpu, int asidx, hwaddr orig_addr,
23 hwaddr *xlat, hwaddr *plen,
24 MemTxAttrs attrs, int *prot)
25 {
26@@ -694,6 +694,7 @@ address_space_translate_for_iotlb(CPUState *cpu, int asidx, hwaddr addr,
27 IOMMUMemoryRegionClass *imrc;
28 IOMMUTLBEntry iotlb;
29 int iommu_idx;
30+ hwaddr addr = orig_addr;
31 AddressSpaceDispatch *d = atomic_rcu_read(&cpu->cpu_ases[asidx].memory_dispatch);
32
33 for (;;) {
34@@ -737,6 +738,16 @@ address_space_translate_for_iotlb(CPUState *cpu, int asidx, hwaddr addr,
35 return section;
36
37 translate_fail:
38+ /*
39+ * We should be given a page-aligned address -- certainly
40+ * tlb_set_page_with_attrs() does so. The page offset of xlat
41+ * is used to index sections[], and PHYS_SECTION_UNASSIGNED = 0.
42+ * The page portion of xlat will be logged by memory_region_access_valid()
43+ * when this memory access is rejected, so use the original untranslated
44+ * physical address.
45+ */
46+ assert((orig_addr & ~TARGET_PAGE_MASK) == 0);
47+ *xlat = orig_addr;
48 return &d->map.sections[PHYS_SECTION_UNASSIGNED];
49 }
50 #endif
51--
522.25.1
53