[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH for-1.7 v2 6/8] exec: don't ignore high address bits
From: |
Marcel Apfelbaum |
Subject: |
[Qemu-devel] [PATCH for-1.7 v2 6/8] exec: don't ignore high address bits on set |
Date: |
Thu, 7 Nov 2013 12:41:22 +0200 |
From: "Michael S. Tsirkin" <address@hidden>
We should never add pages outside target address space,
we had such bugs in the past so add debug message to catch
that quickly if we do, otherwise at least don't corrupt
the page tables.
Signed-off-by: Michael S. Tsirkin <address@hidden>
Signed-off-by: Marcel Apfelbaum <address@hidden>
---
exec.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/exec.c b/exec.c
index aeeaf00..6c3196f 100644
--- a/exec.c
+++ b/exec.c
@@ -52,6 +52,7 @@
#include "exec/memory-internal.h"
//#define DEBUG_SUBPAGE
+/* #define DEBUG_PHYS_PAGE_SET */
#if !defined(CONFIG_USER_ONLY)
static int in_migration;
@@ -204,6 +205,16 @@ static void phys_page_set(AddressSpaceDispatch *d,
hwaddr index, hwaddr nb,
uint16_t leaf)
{
+ if (nb && (index + nb - 1) >= TARGET_PHYS_MAX_ADDR) {
+#ifdef DEBUG_PHYS_PAGE_SET
+ printf("%s: page table corruption: page address " TARGET_FMT_plx
+ " > max supported address %llx\n", __func__, (index + nb - 1),
+ TARGET_PHYS_MAX_ADDR);
+#endif
+ /* at least don't corrupt the page tables */
+ return;
+ }
+
/* Wildly overreserve - it doesn't matter much. */
phys_map_node_reserve(3 * P_L2_LEVELS);
--
1.8.3.1
- Re: [Qemu-devel] [PATCH for-1.7 v2 1/8] exec: declare TARGET_PHYS_ADDR_SPACE_MAX to limit memory regions rendered by exec, (continued)
[Qemu-devel] [PATCH for-1.7 v2 3/8] hw/ppc: limit iommu-spapr memory size, Marcel Apfelbaum, 2013/11/07
[Qemu-devel] [PATCH for-1.7 v2 4/8] exec: don't ignore high address bits on lookup, Marcel Apfelbaum, 2013/11/07
[Qemu-devel] [PATCH for-1.7 v2 5/8] pci: fix address space size for bridge, Marcel Apfelbaum, 2013/11/07
[Qemu-devel] [PATCH for-1.7 v2 7/8] pc: s/INT64_MAX/UINT64_MAX/, Marcel Apfelbaum, 2013/11/07
[Qemu-devel] [PATCH for-1.7 v2 8/8] spapr_pci: s/INT64_MAX/UINT64_MAX/, Marcel Apfelbaum, 2013/11/07
[Qemu-devel] [PATCH for-1.7 v2 2/8] hw/alpha: limit iommu-typhoon memory size, Marcel Apfelbaum, 2013/11/07
[Qemu-devel] [PATCH for-1.7 v2 6/8] exec: don't ignore high address bits on set,
Marcel Apfelbaum <=
Re: [Qemu-devel] [PATCH for-1.7 v2 0/8] fix address space size issue, Alexander Graf, 2013/11/07
Re: [Qemu-devel] [PATCH for-1.7 v2 0/8] fix address space size issue, Paolo Bonzini, 2013/11/07